-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Cant remove items since v1.4.2 #57
Comments
I think I know what's happening. Will you try this: getSelectValues(el) {
return Array.from(el.options)
.filter(option => option.getAttribute('selected') )
.map(option => {
return option.value || option.text
})
}, |
Yes that works. |
Awesome. Yeah, tom-select should already set the selected attribute when an option is selected. If you're not seeing that, let me know. tom-select should also support your original code as well as the modification. I'm working on creating a test case that catches the problem you saw but so far not having any luck. Could you tell me how the items in your app were selected in the first place? Were they html elements like ? Or were they dynamically selected in your framework like option.selected = true? |
The select element and the options are included in the html when the page loads but without any "selected" attribute. On a side note but maybe related, I went back to 1.4.1 and noticed that I was also having problems when adding new items, the JS framework detects only the newly added items but the old ones are detected as unselected, and thus removed. I will try to fix that by setting the selected attribute instead of just option.selected. |
Thanks. I've got a test working now and the fix! |
Just tested it and that fixes all of my problems indeed. |
Hey guys, any plan for a release ? |
Sorry, yes. Should have a release out in a day or two. Just a few more changes needed. |
I have some problems when trying to remove items after upgrading to v1.4.2 or v1.4.3.
Unfortunately I was not able to reproduce it in a jsfiddle environment. I believe it is related to the reactive framework I'm using.
So I will try to explain what I noticed and maybe someone will understand what is happening.
This is how the framework I am using is getting the selected values from the select element.
And that is not working anymore with tom-select v1.4.2 after removing an item because the options from
el.options
are still selected. And yetel.querySelectorAll('option[selected]')
returns the correct selection.Does that make any sense for someone ?
The text was updated successfully, but these errors were encountered: