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