dash_table.DataTable - Determining which rows have changed

When we make table editable, is there a way we can know which rows have changed?

tried using data & data_previous to compare and find out which rows have changed, but there is an issue with that, so if i am editing multiple rows assuming 3 rows, row number 1, 10 & 15 in the same sequence.

data and data previous have difference only in the last edited row. so data_previous will have row 1 and row 10 with the updated number, and data will have all 3 rows updated 1,10 & 15. which is why i am not able to get the exact differences.

Hm, this should work and I’ve used this in the previous projects as the way to determine which rows have changed.

Something like this uses to work in dash table experiments. But this isnt.

@chriddyp - thanks for taking a look, let me know if you find something on this? have tried it a lot unable to get this work.

The answer took a little too long, however, it’s never too late.

This is the best way I found

@app.callback(
    Output('div-result', 'children'),
    [Input('my-table', 'data'),
     Input('my-table', 'columns')],
     [State('my-table', 'active_cell')], prevent_initial_call=True
)
def update_tol_db(rows, columns, cell):
    if(rows == None or columns == None or cell == None):
        raise PreventUpdate
    print(rows[cell['row']])
    raise PreventUpdate

I’m using the updated row to update my database, so this is why I’m not really updating the div.

Seems like it works well with a single row. What is about multiple rows?

I tried to use selected_cells and data for extracting changed data, but selected_cells returns only one row on the paste event as if it would be only active cell.

I ended up with detecting the changed rows by comparing data attribute and data queried from a database, instead of previous_data attribute or workaround with selected_cells.

It’s puts some overhead on performance but works as expected, no unsolvable Datatable bugs.