Here’s a simplified snippet of what I’m trying to implement. How can I make a callback like this work?
Each div-container.children
is a div which has 5 dropdowns each.
So basically, I want to return all 5 lists as options
to 5 different dropdowns present in each child of div-container
@app.callback(
[Output({'type': 'dropdown-1','index': ALL}, 'options'),
Output({'type': 'dropdown-2','index': ALL}, 'options'),
Output({'type': 'dropdown-3','index': ALL}, 'options'),
Output({'type': 'dropdown-4','index': ALL}, 'options'),
Output({'type': 'dropdown-5','index': ALL}, 'options')],
Input('button', 'n_clicks'),
State('div-container', 'children')
)
def create_dropdown_options(h5_file, children):
# some code to prepare dropdown list.... list1, list2,....., list5
output = [list1, list2, list3, list4, list5]
return [output for i in range(len(children))]
For now I’m getting an like this:
dash._grouping.SchemaLengthValidationError: Schema: [<Output `{"index":["ALL"],"type":"group-filter"}.options`>, <Output `{"index":["ALL"],"type":"variable-filter"}.options`>, <Output `{"index":["ALL"],"type":"component-filter"}.options`>, <Output `{"index":["ALL"],"type":"t-signal-selector"}.options`>, <Output `{"index":["ALL"],"type":"group-filter-2"}.options`>, <Output `{"index":["ALL"],"type":"variable-filter-2"}.options`>, <Output `{"index":["ALL"],"type":"component-filter-2"}.options`>, <Output `{"index":["ALL"],"type":"n-signal-selector"}.options`>]
Path: ()
Expected length: 8
Received value of length 1: