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

"changed.bs.select" event not working as expected #1697

Closed
angelpcadena opened this issue Apr 3, 2017 · 5 comments
Closed

"changed.bs.select" event not working as expected #1697

angelpcadena opened this issue Apr 3, 2017 · 5 comments
Milestone

Comments

@angelpcadena
Copy link

Currently the documentation states that "changed.bs.select" does the following:

This event fires after the select's value has been changed. It passes through event, clickedIndex, newValue, oldValue.

But that's not the case, right now it just outputs the event, selected index and two boolean values that are always, true and false, in that order.

I made a jsfiddle: https://jsfiddle.net/SrGoodbar/9xotvca2/

@farhan-syed
Copy link

Getting the same issue, you figure it out yet?

@angelpcadena
Copy link
Author

angelpcadena commented Apr 5, 2017

Yeah, just listen to the change event on the <select> instead of using Bootstrap's events, worked on my case, using KnockoutJS.

@caseyjhol
Copy link
Member

Yea, the current implementation doesn't make a lot of sense. See #1378 (comment)

newValue and oldValue refer to the value of the changed option - either true or false - to see whether the option was changed to be selected or unselected, not the value of the select itself. However, oldValue is a bit redundant, as it's obviously always the opposite of newValue. It would also make more sense to refer to newValue as selected and oldValue as unselected to improve clarity. It would make more sense to also pass in the select's previous value. Passing in the select's current value is unnecessary, as it can easily be retrieved with $(this).val().

I'd like to replace oldValue with the actual previous value of the select.

@angelpcadena
Copy link
Author

Ok, thanks for the clarification!

@caseyjhol
Copy link
Member

Released in v1.13.0! @angelpcadena Please feel free to close this issue.

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

3 participants