Hi,
I have individual sets of states and each has a button where an individual callback is triggered separately for each set, is there a way to have one button which invokes all those callbacks at once too (to be used as a ‘Save all’ mechanism’)
Hi,
I have individual sets of states and each has a button where an individual callback is triggered separately for each set, is there a way to have one button which invokes all those callbacks at once too (to be used as a ‘Save all’ mechanism’)
Have you looked at chained callbacks? That sounds like what you wanted. You can create a new callback with the n_clicks
of the other buttons as the Output
.
something like this for the new callback (not tested):
@app.callback(
Output("button1", "n_clicks"),
Output("button2", "n_clicks"),
Input("new-button", "n_clicks")
def new_callback(new_button_clicks):
return [0, 0]
Note: this resets the n_clicks
of the other buttons so that it will detect the changed n_clicks
and trigger its respective callbacks.