Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Single input updating multiple paired components

$
0
0

Hi all,
I’m looking for a way to let 1 Input update the options of several dropdowns. I’ve come up with the following code:

@app.callback(
    Output({"id": PREFIX, "name": MATCH}, 'options'),
    Output({"id": PREFIX, "name": MATCH}, 'value'),
    Input({"id": PREFIX, "role": "update"}, 'value'),
    State({"id": PREFIX, "name": MATCH}, 'options'),
    State({"id": PREFIX, "name": MATCH}, 'value'))
def update_dropdown(update, initial_options, initial_value):
    if update == 1:
        ...
        return new_options, new_value
    return initial_options, initial_value

However, my callback is never triggered. I feel like it’s due to the Input not having the MATCH keyword.
One alternative would be to use the ALL keyword, but then I would have to match inputs and states for options and values by hand, which might be tedious…

Any thought on this ?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles