ag-gridag-grid-vue

Server-side pagination. How to reset pagination to page 1 on sort?


I'm using ag-grid-vue enterprise 32.1.0. Server-side pagination with server-side sort.

When i sort a column, the params passed to getRows() preserve the startRow and endRow of the current page. How can I reset the pagination to page 1 on sort? Staying on the current page makes no sense.

Thank you!


Solution

  • You can reset your pagination to page 1 by setting the paginationGoToPage prop to 0. This will change your pagination to page 1, regardless of your current page, in response to the sort change event.

    const onFirstDataRendered = (params) => { params.api.paginationGoToPage(0); };

    This answer is referenced from the Official AG Grid Documentation.