KendoReact Data Grid Paging Overview
The KendoReact Data Grid provides a flexible paging mechanism that enables users to navigate large datasets efficiently. The built-in pager allows for numeric and input-based navigation, as well as customizable paging components.
Getting Started with the KendoReact Data Grid Paging
Pagination is enabled in the Grid by setting the pageable property. This adds navigation controls to the bottom of the Grid, allowing users to move between pages.
Enabling Paging
The KendoReact Grid supports paging in two modes:
-
Built-in State Management: The Grid manages its own paging state internally.
-
Controlled Mode: The paging state is externally managed by handling events and updating the state accordingly.
Using the Built-in State Management for Paging
To enable basic numeric paging using the built-in state management mechanism, follow these steps:
- Enable the
autoProcessDataprop to allow the Grid to handle paging automatically. - Set the
pageableprop of the Grid to enable pagination. - Set the
defaultTakeprop to define the number of items rendered initially. - Use the
defaultSkipprop to specify the number of items to be skipped initially, determining the starting page.
The following example demonstrates how to implement numeric paging using the built-in state management of the KendoReact Grid.
Using the Paging in Controlled Mode
To enable numeric paging in the KendoReact Grid and use it in controlled mode, follow these steps:
- Set the
pageableprop of the Grid to enable paging. - Use the
skipprop used to track the current page. - Set the
pageSizeor thetakeoptions of the Grid to specify how many items will be rendered on the page. - Use the
totalprop to notify the Grid how many records are in total, which is needed to calculate the correct total pages. - Handle the
onPageChangeor theonDataStateChangeevent of the Gridfor managing the pagingstate. - Use the
slicemethod or the built-inprocessmethod to manage paging logic.
The following example demonstrates how to implement basic numeric paging in controlled mode.
Pager Types
The Grid supports different pager types:
- Numeric—Renders buttons with numbers.
- Input (responsive)—Renders an input field for typing the page number.
- Custom Pager—Allows you to change entirely the Pager rendering.
The PagerSettings object has the following fields:
buttonCount—Sets the maximum numeric buttons count before the buttons are collapsed.info—Toggles the information about the current page and the total number of records.type—Accepts thenumeric(buttons with numbers) andinput(input for typing the page number) values.pageSizes—Shows a menu for selecting the page size.previousNext—Toggles the Previous and Next buttons.
To set the pager types, pass the PagerSettings object to the pageable option of the Grid.