✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Dropdown filter and datatable

Hey Dash community,

Straight to the point. Here’s the simplified layout of my app:

        {'label': 'New York City', 'value': 'NYC'},
        {'label': 'Montreal', 'value': 'MTL'},
        {'label': 'San Francisco', 'value': 'SF'}
    value=['MTL', 'NYC'],
dash_table.DataTable(id="table")], id="table-container"

The table is selectable because I pass 'selected_row_ids' to a different callback (i.e. plot) which I update based on the selected data of the table.

My issue is that every time I update the dropdown selection, I “lose” the selected row, which I need to reselect.

I played with state a little bit but with no luck :confused: Any ideas how to preserve the selected row when updating the dropdown values?

Hey @Yiannis,
I would suggest you store the selected row in dcc.Store component.

I hope this helps.