Search code examples
ag-gridag-grid-ng2ag-grid-react

React ag grid - event to find if user reached end of grid while scrolling


In ag-grid, we have 'bodySroll' event to listen scrolling. But I want to know when user reaches last record of grid while scrolling.

Is there any way I can acheive this?

Thanks


Solution

  • You can add onScroll listener for the Div which holds your ag-grid and then you can use gridApi.getLastDisplayedRow() this gives you last row index in the current viewport you can use this index to compare with your total number of records present on the current grid if((gridApi.getLastDisplayRow()+1) == totalRecords). In order to update gridApi.getLastDisplayRow()+1 value you need to write it inside onScroll listener function.