Black Lives Matter. Please consider donating to Black Girls Code today.

Have callback set multiple properties of single output target

If you have a dash component that has multiple properties, such as a DatePickerRange:

html.Div([
                dcc.DatePickerRange(
                    id='date-picker-range',
                    min_date_allowed=min_date,
                    max_date_allowed=max_date,
                    start_date=min_date,
                    end_date=max_date
                ),...

you can update individual properties, such as end_date via a callback:

@app.callback(
     dash.dependencies.Output('date-picker-range', 'end_date'),
    [dash.dependencies.Input('refresh-date-btn', 'n_clicks')]
)
def default_datepicker_end(n_clicks):
    return max_date

is it possible to update multiple attributes to the single output target, such as in a dict? Perhaps
something like:

@app.callback(
         dash.dependencies.Output('date-picker-range', 'setProps'),
        [dash.dependencies.Input('refresh-date-btn', 'n_clicks')]
    )
    def default_datepicker_range(n_clicks):
        return {'start_date': start_date, 'end_date': , max_date}

This isn’t possible yet, but you can track the progress in https://github.com/plotly/dash/issues/149

Chris - thanks for the reply and the heads up – I’m really enjoying what I’m able to accomplish with dash.

1 Like