I have a dropdown in dash, like this:
import dash_core_components as dash_core
import dash_html_components as dash_html
...
dash_core.Dropdown(id="department_input_los", placeholder='--choose department--',
options=[{'label': 'All Departments', 'value':
'[\'Gynecology\', \'Urology\', \'Nephrology\',\'Dermatology\']'},
{'label': 'Gynecology', 'value': 'Gynecology'},
{'label': 'Urology', 'value': 'Urology'},
{'label': 'Nephrology', 'value': 'Nephrology'},
{'label': 'Dermatology', 'value': 'Dermatology'},],
value= '[\'Gynecology\', \'Urology\', \'Nephrology\',\'Dermatology\']',
searchable=True)
...
the problem is, when i select first option, call back returns the string stripping down all commas and brackets, like this: GynecologyUrologyNephrologyDermatology
, instead of returning string inside the single quotes in value
key like this:['Gynecology', 'Urology', 'Nephrology','Dermatology']
. I checked this by printing the value that this dropdown returns, to a dash_html.H6
by using a callback.
I will be converting it back to a list and filter my data and then plot a graph.
Also i cannot do multi=True
, because I have another dropdown whose options will be updated by input from this option and having multi=True
is really messing up the process of updating another dropdown’s options.
So, How do i have dash return me my value as it is, without stripping all commas and brackets in the value.