I’ve built a Dash application, with lots of Dropdowns everywhere, some of them with multiple values.
I’ve been asked to add a ‘Select all’ button on all multi-select dropdowns.
To stay DRY, I’ve build a wrapper for dropdowns, and I would need to update it to add the ‘Select all’ button and the corresponding callback there, something like below:
def create_dropdown(*args, **kwargs): dropdown = dcc.Dropdown(*args, **kwargs) if kwargs.get('multi', False): @app.callback(...) def update_value(n_clicks): return kwargs.get(options, ) return html.Div([dropdown, html.Button('Select all', id=...)]) return dropdown
Unfortunately, this way, the callback is not applied, though the button is rendered.
Has anyone any clue how I can achieve the intended behavior ?