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

Hide search box if select is empty #2828

Merged
merged 1 commit into from Nov 25, 2014
Merged

Hide search box if select is empty #2828

merged 1 commit into from Nov 25, 2014

Conversation

LudoMon
Copy link

@LudoMon LudoMon commented Nov 25, 2014

Fix #2822.
When a select box is empty (this appends in my case, I have a dynamic select box), the search box should not be shown.

Fix #2282.
When a select box is empty (this appends in my case, I have a dynamic select box), the search box should not be shown.
@kevin-brown
Copy link
Member

I think you have the wrong ticket number.

Can you also create a pair of jsfiddles that demonstrate the issues and the fix (using the changes here) so we can review this quicker?

@LudoMon
Copy link
Author

LudoMon commented Nov 25, 2014

I had indeed the wrong ticket numer, sorry...
You can see the fiddle : http://jsfiddle.net/DuNzR/1/

@kevin-brown
Copy link
Member

Unfortunately this doesn't appear to hide the search box for me.

I forked the jsfiddle and pulled in the code on this branch: http://jsfiddle.net/ydgne173/

image

Both fiddles give the same result under Chrome 39.

@LudoMon
Copy link
Author

LudoMon commented Nov 25, 2014

Thanks for your time.
I didn't commit on master, but on patch-3, so I updated your fiddle and it works : http://jsfiddle.net/ydgne173/1/

@kevin-brown
Copy link
Member

My bad, I completely missed that it wasn't pointing at the right branch. I've also created a jsfiddle that tests that the fix doesn't hide the search when there is text in the search field.

kevin-brown added a commit that referenced this pull request Nov 25, 2014
Hide search box if select is empty
@kevin-brown kevin-brown merged commit 48ae56a into select2:master Nov 25, 2014
@franckl
Copy link
Contributor

franckl commented Apr 24, 2015

This commit is creating a "Uncaught TypeError: this.showSearch is not a function" when using the latest stable/3.5 branch.

See #1311 (same issue already fixed in the past)

@vevisystems
Copy link

I think this is an unfortunate change, because if createSearchChoice() is provided, the search box should be visible in order for the user to enter the desired text. What about changing:

this.showSearch(search.val());

with:

this.showSearch(search.val() || this.opts.createSearchChoice);

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

Successfully merging this pull request may close these issues.

None yet

4 participants