AutocompleteInput not working inside SimpleFormIterator and ReferenceInput
What you were expecting:
AutoCompleteInput can be used for reference selection inside SimpleFormIterator and ReferenceInput.
What happened instead: AutoCompleteInput doesn't suggest relevant references at the top when user inputs matching text. For example user inputs "Sporting" (there's a place with a name Sporting Center) but this place is not suggested at the top. It seems that places are not filtered at all.
Related code: Displaying items inside the list of references
<FormTab label="resources.tabs.list">
<ArrayInput source="items">
<SimpleFormIterator>
<ReferenceInput label="resources.places" source="id" reference="places" >
<AutocompleteInput optionText="title.en" />
</ReferenceInput>
</SimpleFormIterator>
</ArrayInput>
</FormTab>
List model:
{
...
items: [
{ id: <ID>}
]
}
Place model:
{
id: <ID>,
title: {
en: <EN TITLE>
}
}
Environment
- React-admin version: 2.0.0-RC3
- React version: 16.3.2
- Browser: any
Hi,
I am also encountering something similar to this issue, but I would say, that Autocomplete component doesn't work at all (ie the bug is not related to ReferenceInput or SimpleForm).
After some debug, it looks like Autocomplete.handleSuggestionsFetchRequested method is bugged and does not update the suggestion list. I'm working on a fix and will share it when ready.
The Material-ui autosuggest example helped me in discovering it.
It's the API responsability to filter the items when using a ReferenceInput:
This component fetches the possible values in the reference resource (using the GET_LIST REST method).
Are you sure you return filtered items ?
@djhi: You were right, after thorough debugging I found mismatch between my filtering API calls which I didn't notice before. Thanks for pointing this out! This issue can be closed.