Pagination Schema
The implementation of a GraphQL Service requires a certain structure to follow for Slickgrid-Universal
to work correctly (it will fail if your GraphQL Schema is any different than what is shown below).
Implementation
For the implementation in your code, refer to the GraphQL Service section.
Without Cursor (recommended)
Pagination without cursor, this is the simplest implementation and is what we use on our side. The query can have any of the 3 arguments:
first
: integer representing how many rows of data to get from the start of datasetlast
: integer representing how many rows of data to get from the end of datasetoffset
: integer representing how many to skip
For example
With Cursor useCursor
useCursor
Cursor Pagination is more generally used for real-time data scenarios. It usually reads sequentially from the head or tail of a list. It cannot navigate directly to the middle of a list. It conceptually treats the data similarly to a LinkedList as opposed to a Vector.
Pagination with cursor, the query can have any of the 4 arguments:
first
: integer representing how many rows of data to get from the start of datasetafter
: pull data starting atcursor
"x", where "x" is the last itemcursor
last
: integer representing how many rows of data to get from the end of datasetbefore
: pull data before acursor
"x", where "x" is the last itemcursor
For example
To retrieve subsequent data, the pageInfo.endCursor
property should be used as part of the next query. eg:
or when navigating backwards
When using the paginationService
, this is handled by calling setCursorPageInfo(pageInfo)
.
Also note the difference in behaviour between relay
style pagination as it affects the returned pageInfo
object. eg
Last updated