# Dash DataTable Dynamic Dropdown Options

**URL:** <https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374>\
**Category:** Dash Python\
**Created:** [June 10, 2019, 7:46pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374 "2019-06-10T19:46:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xceleste](https://avatars.discourse-cdn.com/v4/letter/x/ed655f/32.png) [@xceleste](https://community.plotly.com/u/xceleste)\
**Post date:** [June 10, 2019, 7:46pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374/1 "2019-06-10T19:46:25Z")

</div>

I’m having trouble updating the dropdown options in a Dash Datatable based on a callback. Basically, I need each dropdown’s options to change based on the row, which is also dynamic. I keep getting a TypeError: ‘Output’ object is not subscriptable. Can anyone please help, thank you!

```auto

#in the app.layout
column_static_dropdown=[                 
                        {
                            'id': 'Frequency',
                            'dropdown':
                                {
                                    'condition': '{Variable ID} eq "GDPC1"',
                                    'dropdown': []
                                }

                        },

                    ],

#in the callbacks
@app.callback(
    Output('Frequency', 'options')
    [Input('table-dropdown', 'data')])
def frequency(rows):
    all_frequency_options = OrderedDict(
        [('Annual', 'a'), ('Semiannual', 'sa'), ('Quarterly', 'q'), ('Monthly', 'm'), ('Biweekly', 'bw'),
         ('Weekly', 'w'), ('Daily', 'd')])
    for row in rows:
        spec_frequency_options = {}
        for k, v in all_frequency_options.items():
            if k == fred.get_series_info(row['Variable ID'])['frequency']:
                spec_frequency_options[k] = v
                break
            else:
                spec_frequency_options[k] = v
        return [{'label': key, 'value': val} for key, val in spec_frequency_options.items()]

```

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [June 10, 2019, 9:18pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374/2 "2019-06-10T21:18:43Z")

</div>

> [@xceleste](#):
>
> Output(‘Frequency’, ‘options’)

Missing a comma here. Should be `Output('Frequency', 'options'), `

---

<div class="post-metadata">

**Author:** ![xceleste](https://avatars.discourse-cdn.com/v4/letter/x/ed655f/32.png) [@xceleste](https://community.plotly.com/u/xceleste)\
**Post date:** [June 11, 2019, 2:46pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374/3 "2019-06-11T14:46:46Z")

</div>

Thank you! Sorry that was a dumb error. For some reason, the options of the dropdown are still not changing with the callback. Is this because dropdowns within the table don’t respond to callbacks? (this code works with a dropdown outside of the table)

---

<div class="post-metadata">

**Author:** ![xceleste](https://avatars.discourse-cdn.com/v4/letter/x/ed655f/32.png) [@xceleste](https://community.plotly.com/u/xceleste)\
**Post date:** [June 17, 2019, 2:30pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374/4 "2019-06-17T14:30:35Z")

</div>

It seems that the callback doesn’t recognize the dropdowns in the table as part of the layout. Is there another solution to this?

---

<div class="post-metadata">

**Author:** ![tbone](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@tbone](https://community.plotly.com/u/tbone)\
**Post date:** [October 30, 2019, 4:35pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374/5 "2019-10-30T16:35:09Z")

</div>

I am trying to do something similar. Did you ever figure this out? I want to update dropdown options based on a dataframe that is updated periodically.

---

<div class="post-metadata">

**Author:** ![jinnyzor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jinnyzor/32/21194_2.png) [@jinnyzor](https://community.plotly.com/u/jinnyzor)\
**Post date:** [September 27, 2022, 8:20pm UTC](https://community.plotly.com/t/dash-datatable-dynamic-dropdown-options/24374/6 "2022-09-27T20:20:41Z")

</div>

I just stumbled upon this, the dropdowns are controlled by the DataTable’s dropdown value, not the options. Thus, the output in this instance would be:

`Output('Frequency', 'dropdown')`

Keep in mind, any changes you make to this needs to include all combinations and layers of your targeted dropdown elements.
