# Dropdown filter and datatable

**URL:** <https://community.plotly.com/t/dropdown-filter-and-datatable/45462>\
**Category:** Dash Python\
**Created:** [September 29, 2020, 4:19am UTC](https://community.plotly.com/t/dropdown-filter-and-datatable/45462 "2020-09-29T04:19:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yiannis](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@Yiannis](https://community.plotly.com/u/Yiannis)\
**Post date:** [September 29, 2020, 4:19am UTC](https://community.plotly.com/t/dropdown-filter-and-datatable/45462/1 "2020-09-29T04:19:48Z")

</div>

Hey Dash community,

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

```auto
...
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 😕 Any ideas how to preserve the selected row when updating the dropdown values?

---

<div class="post-metadata">

**Author:** ![HarishOsthe](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/harishosthe/32/9949_2.png) [@HarishOsthe](https://community.plotly.com/u/HarishOsthe)\
**Post date:** [September 29, 2020, 9:00am UTC](https://community.plotly.com/t/dropdown-filter-and-datatable/45462/2 "2020-09-29T09:00:29Z")

</div>

Hey @Yiannis,  
I would suggest you store the **selected row** in [dcc.Store](https://dash.plotly.com/dash-core-components/store) component.

I hope this helps.
