How to refresh AG Grid after underlying data changes?

Hello,

I have a dash ag grid with a bunch of data. Currently, that data gets loaded when the page loads (off the id callback) and also when a user changes the value of certain filters at the top of the screen.

I also have ‘add’ and ‘edit’ buttons, where I launch a modal to edit/enter new data.

When the user submits the change, it goes to the database.

I would like to update the data in the ag grid without refreshing the whole page.

What is the best way to do this?

Thanks!

Hello @zack_nc,

You can update the rowData in a callback and it will refresh the data.

Thanks,

This works, except that it scrolls the grid back to the top, and I lose the row selection.

Do you know how I could keep the scroll/selection state of the grid as well?

To maintain the state of the selection and update the rowData, you need to use getRowId and rowTransaction update instead.