How to clear/remove all rows for ag-grid

user2095956 picture user2095956 · Nov 1, 2016 · Viewed 9.7k times · Source

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?

Answer

Sean Landsman picture Sean Landsman · Nov 2, 2016

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