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

Replace empty value in dropdown

$
0
0

Hey there,

I have a multi drop-down that I want to display a default value if its blank:

(dcc.Dropdown(id='dropdown',clearable=False,
 options=[{'label':i,'value':i} for i in areas],
 value=['All'],
 multi=True))

I tried to implement a callback, but this obviously has the same input and output which isn’t correct.

@app.callback(Output('dropdown','value'),
              [Input('dropdown','value')])   
def refresh_dropdown(x):
    
        if x == ['']:
            return ['All']
        else:
            return country

Any ideas how to handle this, I can set up the function that uses the dropdown as an input to use all but would like the user to see that what is being selected.

thanks

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles