Skip to content
API/getPageRange

getPageRange

src/utils/get-page-range.tsfunction
getPageRange(result: PageRangeInput): PageRange

The numbers behind “21–34 of 34”. The wording stays with the app.

Uses the backend’s own from and to when the driver reports them, and otherwise computes them from the page, the page size (or the row count, when the size is unknown) and the rows. An empty page, or a total of 0, is { from: 0, to: 0, total }.

Parameter Type Description
result PageRangeInput A page: a PaginatedCollection or its toPlain() copy

Returns — The first and last row’s positions and the list’s size