I use <Autocomplete>
component in Admin-on-rest.
<ReferenceInput label="Media" reference="Media" source="media_id" allowEmpty>
<AutocompleteInput source="name" />
</ReferenceInput>
If I type something in input, my rest-client get params with:
filter:{q: "1"}
I want replace q on name, to be the same as my source. How can I do it?
You can customize default behavious of { q: [searchText] }
using filterToQuery
prop
.
<ReferenceInput
label="Media"
reference="Media"
source="media_id"
allowEmpty
filterToQuery={searchText => ({ title: searchText })}>
<AutocompleteInput source="name" />
</ReferenceInput>
You can change title
here at { title: searchText }
to whatever you want to send to server.
Documentation: https://marmelab.com/admin-on-rest/Inputs.html#referenceinput
Search for filterToQuery
in above link.