You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/features/pagination.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ export type PaginationInitialTableState = {
30
30
manualPagination?:boolean
31
31
```
32
32
33
-
Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.
33
+
Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginatedRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.
If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.
@@ -70,13 +70,13 @@ No pagination row model is needed for server-side pagination, but if you have pr
70
70
The table instance will have no way of knowing how many rows/pages there are in total in your back-end unless you tell it. Provide either the `rowCount` or `pageCount` table option to let the table instance know how many pages there are in total. If you provide a `rowCount`, the table instance will calculate the `pageCount` internally from `rowCount` and `pageSize`. Otherwise, you can directly provide the `pageCount` if you already have it. If you don't know the page count, you can just pass in `-1` for the `pageCount`, but the `getCanNextPage` and `getCanPreviousPage` row model functions will always return `true` in this case.
//getPaginationRowModel: getPaginationRowModel(), //not needed for server-side pagination
78
+
getCoreRowModel:createCoreRowModel(),
79
+
//getPaginatedRowModel: createPaginatedRowModel(), //not needed for server-side pagination
80
80
manualPagination:true, //turn off client-side pagination
81
81
rowCount:dataQuery.data?.rowCount, //pass in the total row count so the table knows how many pages there are (pageCount calculated internally if not provided)
82
82
// pageCount: dataQuery.data?.pageCount, //alternatively directly pass in pageCount instead of rowCount
@@ -97,7 +97,7 @@ The `pagination` state is an object that contains the following properties:
97
97
You can manage the `pagination` state just like any other state in the table instance.
getCoreRowModel: createCoreRowModel(), //row model
17
17
})
18
18
}
19
19
```
@@ -40,22 +40,22 @@ import {
40
40
getFacetedUniqueValues,
41
41
getFilteredRowModel,
42
42
getGroupedRowModel,
43
-
getPaginationRowModel,
43
+
getPaginatedRowModel,
44
44
getSortedRowModel,
45
45
}
46
46
//...
47
47
consttable = useTable({
48
48
columns,
49
49
data,
50
-
getCoreRowModel: getCoreRowModel(),
51
-
getExpandedRowModel: getExpandedRowModel(),
50
+
getCoreRowModel: createCoreRowModel(),
51
+
getExpandedRowModel: createExpandedRowModel(),
52
52
getFacetedMinMaxValues: getFacetedMinMaxValues(),
53
-
getFacetedRowModel: getFacetedRowModel(),
53
+
getFacetedRowModel: createFacetedRowModel(),
54
54
getFacetedUniqueValues: getFacetedUniqueValues(),
55
-
getFilteredRowModel: getFilteredRowModel(),
56
-
getGroupedRowModel: getGroupedRowModel(),
57
-
getPaginationRowModel: getPaginationRowModel(),
58
-
getSortedRowModel: getSortedRowModel(),
55
+
getFilteredRowModel: createFilteredRowModel(),
56
+
getGroupedRowModel: createGroupedRowModel(),
57
+
getPaginatedRowModel: createPaginatedRowModel(),
58
+
getSortedRowModel: createSortedRowModel(),
59
59
})
60
60
```
61
61
@@ -87,7 +87,7 @@ For normal rendering use cases, you will probably only need to use the `table.ge
87
87
- `getExpandedRowModel` - returns a row model that accounts for expanded/hidden sub-rows.
88
88
- `getPreExpandedRowModel` - returns a row model that only includes root level rows with no expanded sub-rows included. Still includes sorting.
89
89
90
-
- `getPaginationRowModel` - returns a row model that only includes the rows that should be displayed on the current page based on the pagination state.
90
+
- `getPaginatedRowModel` - returns a row model that only includes the rows that should be displayed on the current page based on the pagination state.
91
91
- `getPrePaginationRowModel` - returns a row model without pagination applied (includes all rows).
92
92
93
93
- `getSelectedRowModel` - returns a row model of all selected rows (but only based on the data that was passed to the table). Runs after getCoreRowModel.
@@ -101,7 +101,7 @@ Knowing how TanStack Table processes rows internally can help you gain a better
101
101
102
102
Internally, this is the order in which each of the row models are applied to the data, if their respective features are enabled:
If in any case the respective feature is disabled or turned off with a `"manual*"` table option, the `getPre*RowModel` will be used instead in that step of the process.
0 commit comments