React Data GridView Refresh

react logo

The grid has change detection. So as long as you are updating the data via the grid's API, the values displayed should be the most recent up to date values.

However sometimes you may be updating the data outside of the grids control. When you give data to the grid, the grid will not make a copy. Thus if you change the value of the data outside of the grid, the grid will not be impacted by that data change.

To deal with the scenario where the row data is changed without the grid being aware, the grid provides the following methods:

  • Refresh Cells: api.refreshCells(cellRefreshParams) - Gets the grid to refresh all cells. Change detection will be used to refresh only cells whose display cell values are out of sync with the actual value. If using a cellRenderer with a refresh method, the refresh method will get called.

  • Redraw Rows: api.redrawRows(redrawRowsParams) - Removes the rows from the DOM and draws them again from scratch. The cells are created again from scratch. No change detection is done. No refreshing of cells is done.

Your preference should be to use refreshCells() over redrawRows(). Only use redrawRows() if you find refreshCells() doesn't suit your needs.

Refresh Cells

To get the grid to refresh the cells, call api.refreshCells(). The interface is as follows: