Thanks, I think I’m nearly understanding how to do this.
The thing that’s still confusing me is how to represent the different number of html.div() elements in the children element of ‘div-2’. Right now the best I can figure it out is to append the div’s in the same list, but to actually create the necessary structure is not clear to me. I need the output to look something like this:
html.Div(id='div-2', children=[
html.Div(id='id-' + str(i), children=[html.Button('Reset', id='id-0-'+str(i), n_clicks=0)],
html.Div(id='id-' + str(i), children=[html.Button('Reset', id='id-0-'+str(i), n_clicks=0)]
... for i < value # of divs
]),
But I cant figure out how to get the variable number of html.div() elements to actually show up in this structure out of the for loop. How do I concatenate them together? Right now the best I can figure it out is to create a list of them, but to actually deconstruct that list in the layout is also not clear.
app.layout = html.Div([
html.Div(id='div-1', children=[
dcc.Dropdown(
id='tab1-yaxis-column',
options=[{'label': i, 'value': i} for i in available_indicators],
value=available_indicators[0]
),
]),
html.Div(id='div-2', children=[
]),
])
@app.callback(
dash.dependencies.Output('div-2', 'children'),
[dash.dependencies.Input('tab1-yaxis-column', 'value')])
def update_bottom_div(value):
i=0
return_divs = []
while i < value:
return_divs.append((html.Div(id='id-' + str(i), children=[html.Button('Reset', id='id-0-'+str(i), n_clicks=0)]))
i += 1
return return_divs