Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear/remove all rows for ag-grid

Tags:

ag-grid

I am trying to clear all current rows from my ag-grid. I tried to do this:

aggridOptions.api.setRowData([]);

but this adds me "No rows to show" dialog, then when I am updating the grid with new data the dialog is still appears.

Is there correct way to clear the grid from data rows?

like image 949
user2095956 Avatar asked Nov 01 '16 15:11

user2095956


People also ask

How do you delete all rows in Ag grid?

Sometimes your users want to remove rows and cells in AG Grid by pressing Backspace or Delete keys. The following example uses api. applyTransaction ({...}) to remove selected rows, when the user presses BACKSPACE or DELETE keys.

How do you get all the rows in Ag grid?

selectAll() : Select all rows in the grid, regardless of filtering. api. deselectAll() : Un-select all rows, regardless of filtering.

How do you delete a row on Ag grid react?

For updating rows, the grid will find the row with the same key and then swap the data out for the newly provided data. For removing rows, the grid will find the row with the same key and remove it. For this reason, the provided records within the remove array only need to have an key present.


1 Answers

I've taken a look and this is bug - we'll issue a fix for it in the next release. We'll be issuing a new release on Friday, which will include the fix for this - the next version will be ag-grid 6.3.0.

In the meantime, you can add the following line after addItems which should remove the overlay:

gridOptions.api.hideOverlay()

As I say though, from Friday this line won't be necessary

like image 163
Sean Landsman Avatar answered Sep 17 '22 12:09

Sean Landsman