tablePaginationOptions
function tablePaginationOptions(input): object;Defined in: filters/tanstack-table.ts:734
The pageCount / rowCount table options for a server-paginated table
(manualPagination: true), from the response’s PageInfo. With a total
(totalItems), both are exact; without one (cursor or no COUNT(*)),
pageCount is “this page, plus one more while hasNextPage”, so
getCanNextPage() follows the server.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ pageInfo: | PageInfo | null | undefined; pagination: TablePaginationState; } |
input.pageInfo |
| PageInfo | null | undefined |
input.pagination |
TablePaginationState |
Returns
Section titled “Returns”object
| Name | Type | Defined in |
|---|---|---|
pageCount |
number |
filters/tanstack-table.ts:737 |
rowCount? |
number |
filters/tanstack-table.ts:737 |
Example
Section titled “Example”import { tablePaginationOptions } from "@xtandard/lib/filters/tanstack-table";
const pagination = { pageIndex: 0, pageSize: 20 };tablePaginationOptions({ pagination, pageInfo: { hasNextPage: true, hasPreviousPage: false, totalItems: 45 } });// → { pageCount: 3, rowCount: 45 }tablePaginationOptions({ pagination, pageInfo: { hasNextPage: true, hasPreviousPage: false } });// → { pageCount: 2 }