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

Auto close the menu if maxOptions is set to 1 #1290

Closed
ghost opened this issue Feb 9, 2016 · 4 comments
Closed

Auto close the menu if maxOptions is set to 1 #1290

ghost opened this issue Feb 9, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Feb 9, 2016

I use this option, but want to auto close option block, because data-max-options="1"
<select name="user" data-container="body" class="selectpicker show-menu-arrow" data-max-options="1" title="-Select-" multiple>

I use this option method, because if I use without "multiple" I can't choice empty options.
I find this, but how can add data-max-options option?

@ghost
Copy link
Author

ghost commented Feb 10, 2016

I add that.options.maxOptions == false and it's work, please add to next update version.
// Don't close on multi choice menu if (that.multiple && that.options.maxOptions == false) { e.stopPropagation(); }

@caseyjhol
Copy link
Member

Just do this instead:

<select name="user" data-container="body" class="selectpicker show-menu-arrow" title="-Select-">

@ghost
Copy link
Author

ghost commented Feb 24, 2016

I try this way, but have problem, when I want to unchecked selected option, it's impossible...

@caseyjhol
Copy link
Member

Ah, ok - I see the issue now. I can integrate this into the next version, but I'll use if (that.multiple && that.options.maxOptions !== 1) instead.

@caseyjhol caseyjhol reopened this Feb 24, 2016
@caseyjhol caseyjhol changed the title How can close option block Auto close the menu if maxOptions is set to 1 Feb 24, 2016
avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
simulates usage of a non-multiple select, but allows to deselect option.
close snapappointments#1290
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

1 participant