A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.ag-grid.com/javascript-data-grid/row-pagination/ below:

JavaScript Grid: Row Pagination | AG Grid

Pagination allows the grid to paginate rows, removing the need for a vertical scroll to view more data.

To enable pagination set the grid property pagination=true.

Supported Row Models Copy Link

Pagination in AG Grid is supported in all the different row models. The Client-Side Row Model (the default row model) is used for the examples on this page.

To see the specifics of pagination on the other row models check the relevant documentation for Infinite Row Model, Viewport Row Model and Server-Side Row Model.

The height of the pagination panel defaults to the grid row height. Use the paginationPanelHeight theme parameter to change the height.

The pagination panel can be styled with CSS, use the class ag-paging-panel to target the pagination panel. Use browser developer tools to find class names for specific elements within the pagination panel.

Number Formats Copy Link

The numbers within the Paging Toolbar can be formatted by replacing the thousand and decimal separators. This can be achieved by customising localisation, for more info see Localisation.

Example: Auto Page Size Copy Link

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.

Each pagination page must have the same number of rows. If you use paginationAutoPageSize with auto row height or dynamic row height via the getRowHeight() callback, the page height will be calculated using the default row height and not the actual row heights. Therefore the rows will not fit perfectly into the page if these features are mixed.

When paginationAutoPageSize is used, the grid will not show the page size dropdown selector in the pagination panel, and the option paginationPageSizeSelector will be ignored.

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 if 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.

The example also shows how the grid handles the case where the requested page doesn't exist. In this case, when the users requests page 50, the grid will show the last page (page 18 in this example).

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.

Both Row Grouping and Master Detail have rows that expand. When this happens, consideration needs to be given as to how this impacts the number of rows on the page. There are two modes of operation that can be used depending on what your application requirements.

Mode 1: Paginate Only Top Level Rows Copy Link

The first mode is the default. The rows are split according to the top level rows. For example if row grouping with a page size of 10, then each page will contain 10 top level groups. When expanding a group with this mode, all children for that group, along with the 10 original groups for that page, will get displayed in one page. This will result in a page size greater than the initial page size of 10 rows.

This mode is typically best suited for Row Grouping as children are always displayed alongside the parent group. It is also typically best for Master Detail, as detail rows (that typically contain detail tables) will always appear below their master rows.

In the example below, note the following:

Mode 2: Paginate All Rows, Including Children Copy Link

The second mode paginates all rows, including child rows when Row Grouping and detail rows with Master Detail. For example if row grouping with a page size of 10, then each page will always contain exactly 10 rows, even if it means having children appear on a page after the page containing the parent. This can be particularly confusing if the last row of a page is expanded, as the children will appear on the next page (not visible to the user unless they navigate to the next page).

This modes is typically best if the application never wants to exceed the maximum number of rows in a page past the page size. This can be helpful if designing for touch devices (e.g. tablets) where UX requirements state no scrolls should be visible in the application - paging to a strict page size can guarantee no vertical scrolls will appear.

To enable pagination on all rows, including children, set grid property paginateChildRows=true.

In the example below, note the following:

Fallback to Mode 2 Copy Link

If using either of the following features, the grid will be forced to use the second mode:

This is because both of these features remove top level rows (group rows and master rows) from the displayed rows, making it impossible to paginate based on the top level rows only.

boolean

default: false

Set whether pagination is enabled.

Row Pagination PaginationModule

number

default: 100

How many rows to load per page. If paginationAutoPageSize is specified, this property is ignored.

Customising Pagination PaginationModule

number[] | boolean

default: true

Initial

Determines if the page size selector is shown in the pagination panel or not. Set to an array of values to show the page size selector with custom list of possible page sizes. Set to true to show the page size selector with the default page sizes [20, 50, 100]. Set to false to hide the page size selector.

Customising Pagination PaginationModule

Function

Initial

Allows user to format the numbers in the pagination panel, i.e. 'row count' and 'page number' labels. This is for pagination panel only, to format numbers inside the grid's cells (i.e. your data), then use valueFormatter in the column definitions.

Customising Pagination PaginationModule

boolean

default: false

Set to true so that the number of rows to load per page is automatically adjusted by the grid so each page shows enough rows to just fill the area designated for the grid. If false, paginationPageSize is used.

Auto Page Size PaginationModule

boolean

default: false

Initial

Set to true to have pages split children of groups when using Row Grouping or detail rows with Master Detail.

Pagination & Child Rows PaginationModule

boolean

default: false

If true, the default grid controls for navigation are hidden. This is useful if pagination=true and you want to provide your own pagination controls. Otherwise, when pagination=true the grid automatically shows the necessary controls at the bottom so that the user can navigate through the different pages.

Custom Pagination Controls PaginationModule

The pagination state can be saved and restored as part of Grid State.

The following methods compose the pagination API are all available from api

Function

Returns

true

when the last page is known; this will always be the case if you are using the Client-Side Row Model for pagination. Returns

false

when the last page is not known; this only happens when using

Infinite Row Model

.

PaginationModule

Function

Returns how many rows are being shown per page.

PaginationModule

Function

Returns the 0-based index of the page which is showing.

PaginationModule

Function

Returns the total number of pages.

PaginationModule

Function

Returns the total number of pageable rows, as impacted by gridOptions.paginateChildRows: true. It is recommended to instead use gridApi.getDisplayedRowCount() if not using pagination, or if gridOption.paginateChildRows=true.

PaginationModule

Function

Goes to the specified page. If the page requested doesn't exist, it will go to the last page.

PaginationModule

Function

Navigates to the next page.

PaginationModule

Function

Navigates to the previous page.

PaginationModule

Function

Navigates to the first page.

PaginationModule

Function

Navigates to the last page.

PaginationModule

Function

Initial

Allows user to format the numbers in the pagination panel, i.e. 'row count' and 'page number' labels. This is for pagination panel only, to format numbers inside the grid's cells (i.e. your data), then use valueFormatter in the column definitions.

PaginationModule

PaginationChangedEvent

Triggered every time the paging state changes. Some of the most common scenarios for this event to be triggered are:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4