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!
#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()]