Black Lives Matter. Please consider donating to Black Girls Code today.

Selected_row_ids not updating when selected_rows is changed

I have the impression there is a bug (or a feature I haven’t read about) with the behaviour of datatables.

I have a complex situation in which:

  • a first datatable A has selectable rows (single)
  • a second datatable B has selectable rows (multi)
  • a third datatable C has selectable rows (multi)

When a row is selected in A, rows are populated in B based on that choice (callback update_B_from_A)
When one or multiple rows are selected in B, rows in C are populated based on that choice (callback update_C_from_B)

I am trying to chain the callbacks to ensure that if after selections have been made, the user changes the selection in table A, all previous selections in tables B and C are removed.
I do this by setting the selected_rows in of the Output table to an empty array.

What I observed is that when I do that, the selected_rows_ids of the same tables do not get automatically updated on that basis and carry on holding the same value as before (which then causes other issues in other callbacks that depend on reading the selected_rows_ids of all 3 tables to generate some graphs.

Am I missing something? Should I set both selected_rows AND selected_rows_ids in my Outputs in the callback to ensure both are empty?

Hm, yeah that sounds like it could be a bug but it’s hard to say. any chance you could create a small reproducible example with a few lines of fake data? that’s help us diagnose the issue