AG Grid - Save to SQL after Row Dragged

Hi everyone,

I am building a webapp that has a table that is pulling data from SQL and, if needed, is saving it back to SQL.
I am using Dash AG Grid to build the table and callbacks to read data from SQL and upload it back.

I have just learned that rows in Dash AG Grid can be dragged. It is a cool feature.

When I am saving the table back to SQL after I changed the row order, nothing is happening.
My guess is that change in the row order (row dragging) is not triggering any callback.

Question: How can I trigger the callback as soon as a row is dragged?
I could use dcc.Store as “Output(“store”, “data”)” to store the updated table and then to save it SQL, but what do I use as Input/State?

Hello @mrel,

Very cool, and glad you like the grid.

You will need to use the virtualRowData, I’d recommend using a save button with the state of virtualRowData, it can be quite unpredictable as a trigger.


It worked!

All I had to do is change

State('sql-table', 'rowData')


State('sql-table', 'virtualRowData')

Thank you for quick reply and help, @jinnyzor !

1 Like