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
Select2 triggers unselect event but does not unselect the option #4845
Comments
This does not seem to be the same issue as described in #5049, and is not fixed as of 4.0.6-rc.1. |
So this was confirmed as a bug over three months ago. Almost never will you have your id and your text be the same thing yet this only works with an ajax data source if this is the case, making it unusable with the ajax option. Is there a fix incoming "soonish" for this? |
FYI I banged my head on this for an entire day and came across a little piece of your documentation that talks about how values are converted from the id. It states that the value needs to be a string so its best to send in string id's. Taking this into mind I typecast my id to a string in my API and this issue went away. For those of you that have access / control of their API's this is a fix. For the rest of you maybe try mapping the data element so it does better typecasting of id (not my forte). With 400+ issues and counting I don't see a fix coming any time soon. Also, I tried to look into the code to find out WHY me sending in strings vs ints would be such a big deal since int's usually convert to string rather well and I couldn't find anything. If someone else is more familiar with the code you may be able to use this as a starting point at least. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Prerequisites
master
branch of Select2Steps to reproduce the issue
See this js fiddle for an example of the issue and simpler steps to reproduce
https://jsfiddle.net/xvL14mzv/
Expected behavior and actual behavior
See
https://jsfiddle.net/xvL14mzv/
When I follow those steps, I see...
Option is not removed from the select but an unselect event is triggered
I was expecting...
Option to be removed from the select. This happens when the id and text properties are the same
Environment
Browsers
Operating System
Libraries
Isolating the problem
The text was updated successfully, but these errors were encountered: