I have a set of buttons and a hidden-div that I want to take inputs from. I have managed to get the input from the buttons in the following way
@app.callback(
[
Output('league-table', 'children'),
],
[
Input(str(i), 'n_clicks') for i in df_teams['teams']
],
)
def update_league_table(*args):
changed_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
print(changed_id)
But when trying to get the input from the dropdown component
@app.callback(
[
Output('league-table', 'children'),
],
[
[Input(str(i), 'n_clicks') for i in df_teams['teams']],
Input('intermediate-year-dd', 'value')
],
)
def update_league_table(value, *args):
changed_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
print(value)
I get the below error, which is because the the Inputs from the buttons get wrapped in a list. How can I get both the Input from when a button is clicked and from the hidden div at the same time?
dash.exceptions.IncorrectTypeException: The input argument `[<Input `Arsenal.n_clicks`>, <Input `Aston Villa.n_clicks`>, <Input `Bournemouth.n_clicks`>, <Input `Brighton.n_clicks`>, <Input `Burnley.n_clicks`>, <Input `Chelsea.n_clicks`>, <Input `Crystal Palace.n_clicks`>, <Input `Everton.n_clicks`>, <Input `Leicester.n_clicks`>, <Input `Liverpool.n_clicks`>, <Input `Man City.n_clicks`>, <Input `Man Utd.n_clicks`>, <Input `Newcastle.n_clicks`>, <Input `Norwich.n_clicks`>, <Input `Sheffield Utd.n_clicks`>, <Input `Southampton.n_clicks`>, <Input `Spurs.n_clicks`>, <Input `Watford.n_clicks`>, <Input `West Ham.n_clicks`>, <Input `Wolves.n_clicks`>]` must be of type `dash.dependencies.Input`.
5 posts - 2 participants