experiment_id: web-retrieval-v1
fixture_id: /demos/web-component-grid-cursor-pagination
mode: provenance
representation: html
origin_response_id: 90d445355d0965ff4ecd36fe5e3a3610
version: 2026-10-21
version_created_at_utc: 2026-10-21T20:42:35.563Z
version_nonce: 23d9497ff6c7763ecc793b9247e59404
generated_at_utc: 2026-11-05T09:40:01.707Z
response_nonce: 3db510f02504802e522702b9441d8c78

Cursor Pagination

66 of 125
If your API supports cursor based pagination, so do we! Cursor based pagination is great for CRUD grids or live feeds where the current page of data you are showing can be changing often.
Result Full HTML CSS JS
Edit Download

Full Code

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>ZingGrid: REST API</title>
  <script nonce="undefined" src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
  <style>
    .zg-body zing-grid[loading] {
      min-height: 600px;
    }

    /* hide some inner grid elements */
    .zg-body zing-grid[loading] zg-pager {
      visibility: hidden;
    }

    .zg-body zg-pager zg-select {
      display: none;
    }

    .zg-body zg-load-mask {
      /* set the color to match the gif */
      opacity: .90;
      height: calc(100%);
      /* custom gif for loading */
      background-image: url('https://storage.googleapis.com/zg-demos.appspot.com/starwars_loading.gif');
      /* Center and scale the image nicely */
      background-position: center;
      background-repeat: repeat;
      background-size: contain;
    }

    zing-grid[loading] {
      height: 373px;
    }
  </style>
</head>

<body class="zg-body">
  <zing-grid caption="Cursor Based Pagination" pager page-size="4" search>
    <zg-data src="https://us-central1-zingsoft-demo-endpoints.cloudfunctions.net/cursor-paging/api">
      <!-- where to retrieve data from -->
      <zg-param name="recordPath" value="data"></zg-param>
      <!-- enable server paging -->
      <zg-param name="loadByPage" value="true"></zg-param>
      <!-- enable cursor server paging -->
      <zg-param name="cursor" value="true"></zg-param>
      <!-- return value from cursor endpoint for previous page -->
      <zg-param name="prevIDPath" value="previous_cursor"></zg-param>
      <!-- return value from cursor endpoint for next page -->
      <zg-param name="nextIDPath" value="next_cursor"></zg-param>
      <!-- query param to send back for next/prev cursors -->
      <zg-param name="prevIDKey" value="cursor"></zg-param>
      <!-- query param to send back for next/prev cursors -->
      <zg-param name="nextIDKey" value="cursor"></zg-param>
    </zg-data>
    <zg-colgroup>
      <zg-column index="Date"></zg-column>
      <zg-column index="Close"></zg-column>
    </zg-colgroup>
  </zing-grid>
  <script>
    ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
  </script>
</body>

</html>
<!DOCTYPE html>
<html>
	<head>
    <meta charset="utf-8">
    <title>ZingGrid: REST API</title>
		<script src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
  </head>
	<body class="zg-body">
    <zing-grid 
      caption="Cursor Based Pagination" 
      pager
      page-size="4"
      search
    >
      <zg-data src="https://us-central1-zingsoft-demo-endpoints.cloudfunctions.net/cursor-paging/api">
        <!-- where to retrieve data from -->
        <zg-param name="recordPath" value="data"></zg-param>
        <!-- enable server paging -->
        <zg-param name="loadByPage" value="true"></zg-param>
        <!-- enable cursor server paging -->
        <zg-param name="cursor" value="true"></zg-param>
        <!-- return value from cursor endpoint for previous page -->
        <zg-param name="prevIDPath" value="previous_cursor"></zg-param>
        <!-- return value from cursor endpoint for next page -->
        <zg-param name="nextIDPath" value="next_cursor"></zg-param>
        <!-- query param to send back for next/prev cursors -->
        <zg-param name="prevIDKey" value="cursor"></zg-param>
        <!-- query param to send back for next/prev cursors -->
        <zg-param name="nextIDKey" value="cursor"></zg-param>
      </zg-data>
      <zg-colgroup>
        <zg-column index="Date"></zg-column>
        <zg-column index="Close"></zg-column>
      </zg-colgroup>
    </zing-grid>
	</body>
</html>
.zg-body zing-grid[loading]{
  min-height: 600px;
}
 
/* hide some inner grid elements */
.zg-body zing-grid[loading]  zg-pager {
  visibility: hidden;
}
 
.zg-body zg-pager zg-select { display:none; }

.zg-body zg-load-mask {
  /* set the color to match the gif */
  opacity: .90;
  height: calc(100%);
  /* custom gif for loading */
  background-image: url('https://storage.googleapis.com/zg-demos.appspot.com/starwars_loading.gif');
  /* Center and scale the image nicely */
  background-position: center;
  background-repeat: repeat;
  background-size: contain;
}
// No JS code

Interested in this demo? Modify it to your needs in ZingSoft Studio, our testing sandbox. It's free to sign up, and you can come back and edit at any time!

Edit in Studio

Demo Gallery