-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Autocomplete] onNewRequest to return an object #3789
Comments
I believe this is intender per the documentation First callback param is |
That would be a nice feature. In my use case I have a table beneath an AutoComplete component and the selected result is pushed into the table. Currently I'm storing a copy of incoming |
I'm experiencing this shortcoming as well. I came into it thinking it would function more like a native Select element (ex Select2). |
I'm currently getting around this by Stringifying the object, passing that to text and then parsing to grab the fields I need in onNewRequest (hackey, but works for what I need right now). Example (don't get too hung up on the Ramda stuff - general idea is to stringify the object, then parse when you need to use the object in onNewRequest): //DataSource
const generateDataSource = mapIndexed((company, i) => ({
text: JSON.stringify(company),
value: (
<ListItem
key={i}
primaryText={company.companyName}
/>
),
}));
// AutoComplete
<AutoComplete
hintText="Company Name"
floatingLabelText="Company Name"
filter={R.identity}
searchText={props.companyName}
dataSource={generateDataSource(props.typeAheadCompanies)}
onUpdateInput={props.updateCompanyName}
onNewRequest={R.compose(props.selectExistingCompany, R.pick(['companyName', 'companyId']), JSON.parse)}
/> |
Closed by #4783 |
Hi,
I am using Material UI Components and they are really helpful. I am using an array of objects as datasource for Autocomplete. When I raises an 'onNewRequest' event than it passes the text value rather the object user selects. Can you plz see this.
My DataSource:
My Component:
The text was updated successfully, but these errors were encountered: