To enable pagination in, set the grid property
The following simple example shows this, the only difference to this and previous
examples is the
Pagination does not reduce the feature set of the grid, as long as the underlying row model supports it. In other words, if you are paging over the in memory row model, all features of the in memory row model (grouping, filtering etc) are still available. Likewise for the other row models, if the row model supports it, it's available through pagination and that row model.
If you set paginationAutoPageSize=true the grid will automatically show as many rows in each page as it can fit. This is demonstrated below. Note if you resize the display area of the grid, the page size automatically changes. To view this, open the example up in a new tab and resize your browser.
In this example the default pagination settings are changed. Note the following:
If you set suppressPaginationPanel=true, the grid will not show the standard navigation controls for pagination. This is useful is you want to provide your own navigation controls.
In the example below you can see how this works. Note that we are listening to onPaginationChanged to update the information about the current pagination status. We also call methods on the pagination API to change the pagination state.
A summary of the API methods and events can be found at the top of this documentation page.
The example also sets property suppressScrollOnNewData=true, which tells the grid to NOT scroll to the top when the page changes.
True - Pagination is enabled.
False (Default) - Pagination is disabled.
Number. How many rows to load per page. Default value = 100. If
True - The number of rows to load per page is automatically adjusted by ag-Grid so each page
shows enough rows to just fill the area designated for the grid.
False (Default) - paginationPageSize is used.
True - The out of the box ag-Grid controls for navigation are hidden. This is useful if
False (Default) - when
The following methods compose the pagination API are all available from gridOptions.api
Returns true when last page known. This will always be true if you are using the in memory row model for pagination.
Returns false when last page now known. This only happens when using infinite scrolling row model.
How many rows ag-Grid is showing per page.
Sets the paginationPageSize to newPageSize Then it repaginates the grid so the changes are applied immediately on the screen.
Returns the 0 index based page which ag-Grid is showing right now.
Returns the total number of pages. If paginationIsLastPageFound() == false returns null.
The total number of rows. If paginationIsLastPageFound() == false returns null.
Goes to the specified page. If the page requested doesn't exist, it will go to the last page.
Shorthands for goToPage(relevantPageNumber).
This event is triggered every time the paging state changes, Some of the most common scenarios for this event to be triggered are:
In v9.0 ag-Grid pagination changed from server side pagination to client side pagination. Server side pagination was then removed in v10.1.
If you were doing server side pagination, we recommend moving to pagination with infinite scrolling as a way of migration to the new mechanism.
If you were slicing manually the data in your Datasource to mimic pagination done in the browser only, we recommend that you use the default In Memory Row Model and set the row data as normal and then set grid property pagination=true.