This works fine. However I want to display many graphs from a list of GraphFactory objects. It’s easy to create the objects and put them in the app layout:
graph_list = [ GraphFactory(feature=f) for f in feature_list ]
app.layout = html.Div([
g.graph() for g in graph_list
])
But how can I add the many callback_output(), callback_inputs() and callback_update(value) calls?
You can call the decorator on the object’s callback_update function directly. So for the example from the question you can write:
for g in graph_list:
dash_app.callback(g.callback_output(),
g.callback_inputs())(g.callback_update)
Please note carefully, that g.callback_update has no (), because the app.callback function is applied to the g.callback_updatefunction/method, not as usual to its return value.
Hi! I´m facing more or less the same but I could not find a solution. I tried your approach but no success. Can you share a piece of your code? I don´t have idea where my problem is. This is what I am trying to do:
for ass in asset_list:
id_div = 'target-%s' % ass
app.callback(Output(id_div, 'style'),
[
Input('Button','n_clicks')])(
{'display':'none'})