Nicholas Kuun
Nicholas Kuun

Reputation: 43

React AgGrid Pagination Page changed

I have an AgGrid, I'm simulating row grouping by rendering a table within a full width row. Each time a row is "expanded", a full width row appears below it with it's own table contents. Each time a row is "expanded" I also increase the amount of rows per Pagination Page (this keeps the last row's child on the same page even if the pagination page is full. (It should also be stated that only one child can be expanded at a time))

The issue I'm having is if a user changes pages (I.E. from page 1 to page 2) while there is a an expanded record on page 1, it will mess up future "expands" (since the rowsPerPage did not have an opportunity to reduce itself again)

I'm looking for a way to redraw the table when the page is changed, but if i use onPaginationChanged it triggers every time a row is expanded (Since the PagniationPageSize changes dynamically on row-expansion)

Is there a way to trigger an event each time a user directs to a new page, but not when the Pagniation Page Size changes.

Thank you and sorry in advance.

Upvotes: 1

Views: 4023

Answers (1)

sandeep joshi
sandeep joshi

Reputation: 2151

you may use newPage property to check if the page has changed.

onPaginationChanged(params) event provides params object which contains newPage property which is set to true only when page is changed. If for some reason page size has changed or any other operation is performed which does not change the page number then this property is false

plunkrLink

Upvotes: 2

Related Questions