✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Let callback wait for the user to select/deselect multiple checkboxes in checklist


I have the following scenario:
A checklist with many checkboxes that updates a figure by plotting one line if the corresponding checkbox is selected.
Due to some processing there is a delay between the callback call and the update of the figure (this is not a big issue though).
I’d like the user to be able to select or deselect multiple checkboxes before the callback is fired, I’d put a delay of let’s say 2-3 seconds so that the user is able to do some quick multiple selection.
Is it possible? I couldn’t find any docs or related questions in the forum.
Thank you in advance!

Hello @andins,

One solution would be to use the checkbox values as a state and add an update button in your app. And let the callback fired when the button is clicked.

The callback would be something like this:

    Output(component_id="output-div", component_property="children"),
    [Input(component_id="update-button", component_property="n_clicks")],
    [State(component_id="my-checklist", component_property="value")],
def update_div(n, value_chosen):

Thank you so much for your quick reply @atharvakatre !
I had thought of this possible solution (and I’ll go for it if there is no better option) but I wanted to avoid the need for an extra click and also an extra button in page (there’s already quite some stuff).
Anyway if there’s no other option this solution would be fine.

1 Like