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

How to get the val by click 'SelectAll' #1284

Closed
vlux opened this issue Feb 4, 2016 · 5 comments
Closed

How to get the val by click 'SelectAll' #1284

vlux opened this issue Feb 4, 2016 · 5 comments

Comments

@vlux
Copy link

vlux commented Feb 4, 2016

I used the code below to get the selected val.

var sl = $("#id")
sl.on("changed.bs.select", function(e) {
        console.log(sl.val())
    })

But when I click the 'SelectAll', the console didn't log so how can I get the all values by the 'SelectAll'

Thank you guys!

@caseyjhol
Copy link
Member

Currently changed.bs.select isn't fired when "Select All" or "Deselect All" are clicked. It should be, but that event is mainly used so you can know which option was actually changed when the select value is changed (not possible with jQuery's change event). I'll fix this in an upcoming update.

You can fix it in your own code by adding that.$element.trigger('changed.bs.select'); after line 1248

@vlux
Copy link
Author

vlux commented Feb 5, 2016

It works! 👍
Thank you casey. Hope the Bootstrap-Selec' Long Live :)

@crevete
Copy link

crevete commented Feb 17, 2016

@caseyjhol Your fix is not exactly correct. If I select all options, then I call selectAll, the changed.bs.select event should not be fired. It should ONLY be fired when the value are really changed. Same issue with deselectAll.

@aval-sarri
Copy link

How do I get if selectAll or DeselectAll is clicked, in changed.bs.select event? I see undefined

@dipan-provlg
Copy link

We have separate issue for this and it is here . Is there anything at this moment for catching Select All or Deselect All?

caseyjhol added a commit that referenced this issue Jul 20, 2017
avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
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

5 participants