Closed maatouk-j1 closed 1 year ago
@maatouk-j1 Have you tried using a custom filter
callback for more control?
<Command
filter={(value, search) => {
if (value.includes(search)) return 1
return 0
}}
/>
Thank you for pointing that out! I was able to successfully implement my desired search functionality using the filter.
@maatouk-j1 Have you tried using a custom
filter
callback for more control?<Command filter={(value, search) => { if (value.includes(search)) return 1 return 0 }} />
The solution fixed the problem. Thank you very much!
Hi,
I'm creating a Combobox where users can search and select a cryptocurrency. A parent cryptocurrency has a ticker (some sort of code for the currency), and child cryptocurrencies containing a name and a code.
For example, the USDT cryptocurrency (parent) has the following properties: ticker: USDT child cryptos: 1) - name: Tether (TRON)
Now I want the Command component to have the value of the parent cryptocurrency ticker, but the search functionality should take into consideration the child cryptocurrencies names and codes, not just the parent cryptocurrency ticker.
Code:
When searching for a cryptocurrency, if I input "USDTTRC20" in the search input field, I get "No cryptocurrency found." instead of getting the correspondent cryptocurrency ticker which is USDT.
It seems that the Command component only searches for whatever value is used in the Command Item component, which in my case is the cryptocurrency ticker.
Is there a way to search for more than a value when using the Command component?
Thanks!