You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read 10 times the documentation but I still don't understand how am I supposed to use the filterBy and the labelKey fields. So until now I only needed to search by unique field (name field). I used the labelKey prop that works well:
But now I want to be able to also search by nickname field (note that this field is optional on my data, maybe it matters idk). So I look into the documentation and found the filterBy prop that seems to do what I need ! And now is the problem, I don't know how to use it and everything I tried failed.
Are we supposed to replace labelKey with filterBy={['name', 'nickname']} ?
This lead to the following error:
One or more options does not have a valid label string. Check the labelKey prop to ensure that it matches the correct option key and provides a string for filtering and display.
Are we supposed to keep the labelKey=name and add filterBy={['nickname']} ?
This does not work either, I am getting the following warning and it triggers so much time that it almost make my browser crash:
Fields passed to filterBy should have string values. Value will be converted to a string; results may be unexpected.
Are we supposed to use a fonction like labelKey={o => `${o.name} ${o.nickname}`} and add filterBy={['name', 'nickname']} ?
This actually works but it clearly seems to ignore the filterBy field. Also when searching by name I get the autocompletion, however when searching by nickname I get the result but no autocompletion in the search bar.
So I have several questions:
Why the labelKey is for both search and labeling and not just for labeling ? It clearly conflict with filterBy (or I didn't understand the purpose of filterBy)
Thus it seems that I'm not able to search among fields that are not displayed in the label ?
What is the use of filterBy with an array of string? I really don't manage to make it work
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello guys!
I read 10 times the documentation but I still don't understand how am I supposed to use the
filterBy
and thelabelKey
fields. So until now I only needed to search by unique field (name
field). I used thelabelKey
prop that works well:But now I want to be able to also search by
nickname
field (note that this field is optional on my data, maybe it matters idk). So I look into the documentation and found thefilterBy
prop that seems to do what I need ! And now is the problem, I don't know how to use it and everything I tried failed.labelKey
withfilterBy={['name', 'nickname']}
?This lead to the following error:
labelKey=name
and addfilterBy={['nickname']}
?This does not work either, I am getting the following warning and it triggers so much time that it almost make my browser crash:
labelKey={o => `${o.name} ${o.nickname}`}
and addfilterBy={['name', 'nickname']}
?This actually works but it clearly seems to ignore the
filterBy
field. Also when searching byname
I get the autocompletion, however when searching by nickname I get the result but no autocompletion in the search bar.So I have several questions:
filterBy
(or I didn't understand the purpose offilterBy
)filterBy
with an array of string? I really don't manage to make it workBeta Was this translation helpful? Give feedback.
All reactions