palantir-foundryfoundry-slate

How to get a pageToken for pagination?


Let's assume I have a table on Slate with pagination enabled with a pageSize of 10 that is backed by an Object-Service-API query which has the following body format:

{
  "objectSet": "objectSet.ObjectSet",
  "objectSetContext": "optional<ObjectSetContext>",
  "pageSize": "integer",
  "pageToken": "optional<PageToken>",
  "sort": "optional<list<PropertySort>>"
}

Let's also say I have 100 records total, when I first run the query, I start with "pageToken": null and the response gives the first 10 of the 100 records. The response also includes a pageToken set to something like: "v1.abc-some-uuid-xyz.10".

Now if I want to reach page 5 of the results which should show results 41 to 50, what do I pass as a pageToken to reach those results specifically?

  1. In the case there is an existing valid page token from the first page query?
  2. In the case no pageToken is currently set or it has already expired?

I couldn't find any documentation on the object-service-api. All I could find is in the Slate query tab. screenshot of query tab for OSS


Solution

  • There is a section in the internal documentation under /documentation/product/slate/writeback-foundry hinting at passing the pagination offset value as the page token. This means that it can be a changing integer value. No need to prefix by parsing the previous pagingToken. Example:

    "{{w_tableWidget.gridOptions.pagingOptions.currentOffset}}"