Hi @chriddyp. Been trying to do the same but am facing the challenge where the error am getting is Layout must be a dash component or a function that returns a dash component. What I tried doing is generate a daytaframe from selected values using iterations in a function which is called buy the @app.callback. The Inputs are generated by the dropdown. see depleted code below def Creator(value): ... return df def generate_table(dataframe, max_rows=10): return html.Table() app.layout = html.Div([ dcc.Dropdow(id='my-dropdown.), dcc.Graph(id='my-graph') dt.DataTable(id='my-datatable') ]) @app.callback(Output('my-graph', 'figure'), [Input('my-dropdown', 'value')]) def update_graph(dropdown_value): return Figure @app.callback(Output('my-datatable', 'rows'), [Input('my-dropdown', 'value')]) def update_table(value): dff = Creator(value)# update with your own logic return generate_table(dff)
Hi @Dee,
I’m not an expert but one clarity, are these labels- ‘my-graph’ and ‘my-dropdown’, used in callback,defined in your layout? Because in above code I don’t see the layout containing them.
e.g.
app.layout = html.Div([
dcc.Dropdown(id = ‘my-dropdown’),
dcc.Graph(id = ‘my-graph’)
dt.DataTable(id = ‘my-datatable’)
])
Solved it, my callback had a condition, like I set the dropdown to be empty so whenever I ran the generate table would receive an empty array, hence the error