I’m trying to use the ‘list’ argument for the dash ‘Input’ component. The ‘help’ information shows the below…
| - list (string; optional): Identifies a list of pre-defined options to suggest to the user.
| The value must be the id of a element in the same document.
| The browser displays only options that are valid values for this
| input element.
| This attribute is ignored when the type attribute’s value is
| hidden, checkbox, radio, file, or a button type.
Therefore, I’m trying to add a Datalist element as well to house the ‘suggestions’ to my input component. However, I’m unable to get my input component to show any suggestions. My code is below… this actually allows me to use the input component to control many other components but without suggestions.
I couldn’t find any examples in the various galleries. I also tried setting the list within Datalist to ‘values’ or ‘options’ like you might in a Dropdown component but its not a valid argument. Has anyone gotten this to work so far?
I’m guessing its a misunderstanding on my end with how to interact with the html reach components.
Thanks for the reply Chris. I actually was using that example you posted as a template but when I set options=[{‘label’:i, ‘value’:i} for i in numpy.unique(df[‘DATA’])] I get the following error within dash\development\base_component.py
Agreed on using a Dropdown component but chose not to because I want my user to be able to type any input without being constrained to a list of options. My understanding is that Dropdown gives a finite list while using a Datalist with Input component simply gives a suggested value as the user types.
Also, just a heads up, it looks like the Datalist features are not supported in Safari and may not work in IE or Edge: http://caniuse.com/#search=datalist
This works! I was close… just needed the html.Option(value=…) portion… sigh
A more detailed explanation of my use-case:
The Input component drives three tables, two of which will always populate with some set of information. The third table is a smaller list of the same key values so I want the Datalist to suggest in the Input component key values that are in the third table but not restrict it to only that set of keys. That way if the user wishes they can Input a key for the first two tables while the third returns nothing.
Thanks for the heads up on browsers, I had seen this and definitely need to consider it as I roll out to any users.
Hi @chriddyp. I would like to set the 'html.Option(value=‘chrome’) tags with strings i have stored in a separate list. Is their a way to loop through a list to set these tags inside the children property of the html.Datalist component?