0
votes

I am working on react ag grid and I am using infinite scrolling feature of ag grid. I want feature where I can delete row and grid will immediately refresh its data. But "remove row" feature is not available for infinite scrolling.

https://www.ag-grid.com/javascript-grid-infinite-scrolling/#api-inserting-removing-rows

Can anyone please suggest me anyway achieving this?

Thanks

2

2 Answers

2
votes

There's a hint right there if you scroll down a bit:

Adding / removing rows directly in the grid for infinite scrolling is not recommended as it will complicate your application. It will make your life easier if you update the data on the server and refresh the block cache.

And then scroll down to the "Insert And Remove Example", there's example code showing how to remove rows (with a mocked up data source):

function removeItem(start, limit) {
    // here you would make a call to your data source to remove the rows
    allOfTheData.splice(start, limit);
    // get fresh data from the source
    gridOptions.api.refreshInfiniteCache();
}

Try to read the documentation more carefully, you've asked a couple of questions that are already directly answered in it. It's all literally on the page you linked to.

0
votes

You can make a use of the following grid api this.gridApi.setRowData(this.rowData);

If you are fetching the data from server side, then get the data first and then call the setRowData() method.