Custom pagination required

We have an API that takes a count and start value to determine how many items to skip in the DB query result and how many to return. The API response is structured like this
{items: data[], nextStart: 24, total: 48}

I can’t seem to figure out anyway to get the serverside pagination offered to work with this kind of a setup. I’m having to resort to a custom implementation with buttons, but it would be ideal to use the retool feature.

Hey Kevin,

It sounds like this is an example of Limit-offset pagination, where the count is the limit, and the start represents the offset.

To get this set up, you just need to do a few things:

  1. Create a query and display the data in the Table, and then enable server side pagination in the table settings. You'll want to select "Limit-Offset" for the pagination type.
  2. In your query, you will use the .pageSize and .paginationOffset for example

You can also set the table up to allow for jumping to arbitrary pages. To do this, you need to provide the Table the total number of results in the entire dataset being paginated through. It looks like your query response provides this information in a property called total. You would simply need to put the following into the "Number of rows in this table" property under the table's pagination settings:

1 Like