1

I have a DataTable with some line graphs displaying the values. I want to implement it such that clicking a single point in the graph will filter the table data to that trace and select the row which the user specifically clicked on. I have used the pandas index and created a 'id' row so that each row has a unique id associated with it. This is my callback i am trying to use

@app.callback(
    [Output("datatable-rfStats", "data"), Output("datatable-rfStats", "selected_row_ids")],
    [Input("dev-lvl-clear", "n_clicks")] + plot_dev_lvl_filter_inputs
)
return filtered_df.sort_values(by=['lastUpdated']).to_dict('records'), [row_id]

I have the DataTable setup for multi selectable rows. When i click on the line graph the DataTable filters the data correctly but does not select the requested row. I have debugged and confirmed that the 'row_id' is in the set of rows being returned. Not sure if i'm doing something wrong or if the multiple outputs doesnt work as i expected.

Note: plot_dev_lvl_filter_inputs is just an array which i am dynamically filling with the Inputs() for the charts I am displaying. I can go into more depth on this setup if its relevant but all the graph inputs work perfectly so I don't think this is the issue

1
  • I think it worked in the past, but with the current version of dash datatable it does not seem to work. Commented Mar 4, 2021 at 19:01

1 Answer 1

2

Try this:

@app.callback(
    [Output("datatable-rfStats", "data"), Output("datatable-rfStats", "selected_rows")],
    [Input("dev-lvl-clear", "n_clicks")] + plot_dev_lvl_filter_inputs
)
return filtered_df.sort_values(by=['lastUpdated']).to_dict('records'), [row_id]

Instead of setting selected_row_ids use selected_rows.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.