In a dash app, with a table, the “backend paging with sorting” functionality is implemented. The code for which is referenced from Python-Driven Filtering, Paging, Sorting | Dash for Python Documentation | Plotly.
The app upon loading checks some of the rows with the following code in the layout of dash_table.DataTable(
The user can then select more rows by checklists. However, after applying the custom sort, the following code doesn’t preserve the checkboxes:
def update_table(page_current, page_size, sort_by,table_checked_row_ids):
dff = df.sort_values(
ascending=sort_by[‘direction’] == ‘asc’,
# No sort is applied
dff = df
When I print the list of selected/checked row-ids, “derived_virtual_selected_row_ids”. I can see all the selected/checked rows. but these checks are not preserved when the sorting is applied.
I am returning the following the function:
return table_checked_row_ids, dff.to_dict(‘records’)
Any help is much appreciate. Why are the checkboxes not returned to the rows of table as earlier.