Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Dropdown Search does not recognize spaces or metacharacters #1233

Closed
marketemp opened this issue May 5, 2020 · 2 comments
Closed

[BUG] Dropdown Search does not recognize spaces or metacharacters #1233

marketemp opened this issue May 5, 2020 · 2 comments

Comments

@marketemp
Copy link

I am using:

dash 1.11.0
dash-core-components 1.9.1
dash-html-components 1.0.3
dash-renderer 1.4.0
dash-table 4.6.2

This issue is not Front-End Related

Describe the bug

I am using the dcc.Dropdown with a list of over 5000 stock ticker symbols. After struggling with the issue [BUG] Dropdown Search must prioritize front matches before body matches #1232, I thought a solution would be to change my label values to '{symbol} - {company_name}'. That way if I wanted Macy's, typing M(space) or 'M -' should find 'M - Macy's'. Unfortunately, it works (or doesn't work) exactly the same way. There seems to be no search recognition of the space or dash to get to 'M - Macy's' before 'AAL - American Airlines Group' and every other label including an M or m in the ticker symbol or the company name.

Expected behavior

It would be expected that a dropdown searchbar return correct matches of label strings that include spaces and other meta-characters

Screenshots

Screenshots are attached as well as a file including my list of stock symbols + company name to use as labels
Screen Shot 2020-05-05 at 4 30 10 PM
syms.txt

@marketemp
Copy link
Author

chriddyp pointed me to the Dynamic Options example on https://dash.plotly.com/dash-core-components/dropdown and I solved issues 1232 and 1233 using:

return [o for o in options if re.match(search_value, o["label"], re.IGNORECASE)]

for front matches only or:

opt = [o for o in options if re.match(search_value, o["label"], re.IGNORECASE)]
opt.extend([o for o in options if o not in opt and search_value in o["label"]])
return opt

for front matches, then body matches. It still would be great if search worked this way, or there was an option to make search work this way using the options= argument of the dcc.Dropdown component.

@gvwilson
Copy link
Contributor

Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants