Help in creating Dynamic dropdown

I have created dynamic dropdowns. I iterated the python list in callback function and binded to html div.

But I’m stuck with issue-

@app.callback(
Output(‘container’, ‘children’),
[Input(‘drop-down’, ‘n_clicks’)],
[State(‘container’, ‘children’)]
)
def display_graphs(n_clicks, div_children):

for i in filter_list:
    lst = result_df[i].unique()
    new_child = html.Div(
        children=[
            html.P(i, className='fix_label', style={'color': 'white'}),
            dcc.Dropdown(id=i,
                         multi=True,
                         searchable=True,
                         value=None,  # final_df2['Category.display'].unique(),
                         placeholder=i,
                         options=[{'label': c, 'value': c}
                                  for c in lst], className='dcc_compon'),
        ]
    )
    div_children.append(new_child)
return div_children

Now, based on the dropdown value the datatable should change. Suppose the drop column A has value 72 so in datatable it should filter and show value for only row having value 72. Could please help me writing callback function in this case ?

Because as you can see above the ‘id’ for dropdown is a variable ‘i’ which is dynamic. How can I get that in input of app.callback

You should post your initial attempts here, then ppl can help you :wink:

2 Likes

Ohh! Thanks for you reply.