You probably don’t need a custom matcher; you do need to format your data array items correctly. They are currently missing the text
field, which is required (and is what the default matcher matches against). You could compose the text
field’s value from the existing fields, like so:
data: myData.map(item => ({...item, text: `${item.username}|${item.firstname}|${item.lastname}|${item.mail}`})),
This code returns a new data array that contains all of your data items with an additional text
field consisting of the username
, firstname
, lastname
and mail
fields separated by vertical bars (you could use any other separator you want; it should be a character that won’t appear in your fields’ values, and a character that users will be unlikely to type in the search box).
Your placeholder is not appearing because you don’t have an empty <option>
as the first item in your select list. See the note under the single select placeholder documentation.