Dropdown filter and datatable

Hey Dash community,

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

...
dcc.Dropdown(
    options=[
        {'label': 'New York City', 'value': 'NYC'},
        {'label': 'Montreal', 'value': 'MTL'},
        {'label': 'San Francisco', 'value': 'SF'}
    ],
    value=['MTL', 'NYC'],
    multi=True
) 
...
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.