I’m using an autocomplete and showing a number of fields from the results to give plenty of clarity but I don’t want all the fields to be used in the actual search.
Eg. If I have a list of names and their ages, my dropdown will show ‘Jon aged 21’ but I don’t want it to appear if someone types ‘21’ in the field.
I also have something slightly different that I think a tweak to Autocomplete might help with as well as this one. At the moment it only has 2 bound data values, the text to display and the value it gives. I propose that a 3rd is added - a search string.
In my case I have users and I want to only show their names but actually be able to search based on other values such as their status.
In my case:
Text to display: {{name}}
Value: {{UserID}}
Search string: {{name+' '+status}}
In Jon’s case it could be:
Text to display: {{name+' ('+age+')'}}
Value: {{UserID}}
Search string: {{name}}
If left blank - to allow compatibility with existing uses of the component, it could default to the display text for the search string.
Thanks Patrick. Almost there. It’s correctly searching only the name now but the dropdown isn’t appearing. If I type something in which should return something, it appears to do nothing. If I type something in which shouldn’t return anything, it shows the ‘No results’ message correctly.