Auto-complete dataSource
Hey guys thanks for the new component !!. Is posible to pass to the dataSource an array of objects ? Eg:
[
{
value: 'es_AR',
name: 'Spanish'
},
{
value: 'en_US',
name: 'English'
}
]
Thanks !
This would be more consistent with the SelectField. I often want to get an identifier from a dropdown list instead of a plain text. :+1:
I agree, this would be useful.
For info, react-toolbox takes a dataSource in the form { identifier1: displayedText1, identifier2: displayedText2, ... }.
I think the best way would be to accept either an array of strings, or an object in this form when you want to get an underlying value.
Or maybe the same array of object that SelectField accept to be consistent with it ?
@jgoux That form lacks flexibility, you can't have Objects, Boolean, Regex, and a lot more as object property identifier. and they have very valid use cases. I'd go with the { value, payload } style already applied to select field.
@k010 @subjectix , I like the idea. I am going to work on it and make it consistent with SelectField. This component is still quite new, I'd love to see more contribution from others that makes it more flexible. :)
text-value list dataSource support #2286
+1 @yongxu thanks !!!
#2286 made this possible.
Hi. Is there any documentation on this?
I was checking here: http://www.material-ui.com/#/components/auto-complete but couldn't see anything relating this particular dataSource syntax.
There still doesn't seem to be documentation of what can be passed as a datasource beyond an array of strings.
@Sigfried What about the ExampleDataSources?
I just noticed those. They definitely give better hints. I think what I want is in the third example, but it takes a little time to parse: I guess if I want displayed text to be different from the saved value I need a dataSourceConfig.
Yeah, the examples should do it for me. I wasted some time trying to find a list of properties I could send to dataSource (or dataSourceConfig). Maybe there's some way to indicated that the places to look are in the examples and the source code, there's no api doc for those specific fields.