Basic pagination
Pass pageSize to useDataGrid to split data into pages, 10 rows per page by default.
Add DataGrid.Footer as a child of DataGrid to display the status text, the page size select
and the page buttons:
Status formats
By default, the status text is 1–10 of 20. Set statusFormat="long" to display
Showing 1–10 of 20 instead. The number of selected rows is added while rows are selected:
Arrows
Set pagination="arrows" to replace the page buttons with a Page 1 of 2 label and
previous / next controls:
Compact layout
In a narrow grid, the footer hides the page size select and replaces the page buttons with
a Page 1 of 2 label. The breakpoint depends on the grid size and statusFormat.
Resize the demo to see it:
Status only
Set pagination="none" to display the status text only:
Page size
Use pageSizeOptions to change the options of the page size select, [10, 25, 50, 100] by
default. Set withPageSize={false} to hide the select, use selectProps to pass props to it:
paginationProps are passed down to the Pagination component.
One page
When all rows fit on one page, the footer hides the page buttons.
The page size select stays while a smaller page size would add pages.
Set hideWithOnePage={false} on DataGrid.Footer to keep the page buttons:
Controlled pagination
Pass pagination and onPaginationChange to useDataGrid to control pagination state.
The state is an object with pageIndex and pageSize:
Current page: {"pageIndex":0,"pageSize":5}
Custom footer
Pass children to DataGrid.Footer to replace the default controls with your own.
Use store.getPagination(), store.table.getRowCount() and the navigation methods below to build them.
A footer built without DataGrid.Footer must set the --dg-footer-height CSS variable
for the floating selection bar to stay above it:
Page navigation methods
Use store.table methods to change the page programmatically:
Auto-reset page index
By default, the page index resets to 0 when data, sorting or filtering changes.
Pass autoResetPageIndex: false to useDataGrid to keep the current page:
Server-side pagination
Set manualPagination and provide rowCount with the total number of rows, or pageCount
if you only know the number of pages:
Without rowCount and pageCount, the footer displays Page 3 with previous / next controls.
See the Server-side page for a complete example.
Labels
Use labels prop of DataGrid to translate the footer texts:
footerRange–{from}–{to} of {total}footerRangeLong–Showing {from}–{to} of {total}footerRows–{count} rowsfooterRowsOne–{count} rowfooterSelected–{count} selectedfooterPage–Page {page} of {total}footerPageUnknownTotal–Page {page}pageSize–{count} / pagepageSizeLabel–Rows per pagepaginationPrevious–Previous pagepaginationNext–Next page