Search code examples
ag-grid

Ag-grid how to find the current page for a specified row (with sorting enabled)?


I have a multi-page ag-grid with sorting enabled.

When a new item is added to the ag-grid, it may add it on a different page (not the currently visible page) depending on the sort selections. Is there a way to retrieve the page number for a specific row-number from the AG-grid api?

(Note that the row indexes are typically not in order when the ag-grid is in a sorted state.)


Solution

  • var goToPage = Math.floor(rowIndex / this.grid.gridOptions.api.paginationGetPageSize());