choc-autocomplete
choc-autocomplete copied to clipboard
Autocomplete is showing a match if the 7 last char are equal even if the "x" other are not
Hi all, sorry for bad eng. My autocomplete is showing a match if a word contains the 7 chars that are at the end of the user input but it is not checking if the first one is equal. if i search "USA1234567" i will get in return any value that ends in "1234567" or any other sequence of 7 chars like:
const countries = [
"Random1234567",
"Qwerty1234567",
"Azerty1234567",
"USA1234567",
];
How can i return only value that strictly match at the starts? I have tryed to search in the issue but i cannot find anything
my code is:
<AutoComplete openOnFocus>
<AutoCompleteInput variant="filled" />
<AutoCompleteList>
{countries.map((country, cid) => (
<AutoCompleteItem
key={`option-${cid}`}
value={country}
textTransform="capitalize"
>
{country}
</AutoCompleteItem>
))}
</AutoCompleteList>
</AutoComplete>
Hi @mDeSimone-DFactorySrl
What you're seeing is a result of the default filter being fuzzySearch
. To get around it, you can pass in your own filter
prop. I am not at a computer to give an example at the moment, but I can post one once I am back.
Here is a link to another issue that has an example custom filter.
https://github.com/anubra266/choc-autocomplete/issues/249
Here is a link to another issue that has an example custom filter.
https://github.com/anubra266/choc-autocomplete/issues/249
Thanks i will try :)
Let me know if that works or not. I'm back now and can drum up an example.