-
Notifications
You must be signed in to change notification settings - Fork 9
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
multibox plugin is not selecting the option-tags #10
Comments
For those who use vanilla javascript, I edited @ChristianSchmidt1981 code: `function setSelectBoxByText(eid, etxt, sel = true) { multiSelect.subscribe(function(event) {
});` |
I had to use |
Okay. I'm confronted with the same issue. Here's how I wired in the missing pieces with vanilla javascript: const foobar = new IconicMultiSelect({
select: "#foobar",
});
foobar.subscribe(function (evt) {
switch (evt.action) {
case 'ADD_OPTION':
for (i = 0; i < foobar._selectContainer.options.length; i++) {
if (foobar._selectContainer.options[i].value == evt.value) {
foobar._selectContainer.options[i].selected = true
foobar._selectContainer.options[i].setAttribute("selected", "")
}
}
break;
case 'REMOVE_OPTION':
for (i = 0; i < foobar._selectContainer.options.length; i++) {
if (foobar._selectContainer.options[i].value == evt.value) {
foobar._selectContainer.options[i].selected = false
foobar._selectContainer.options[i].removeAttribute("selected", "")
}
}
break;
}
})
foobar.init(); |
I think in your ADD_OPTION case you have |
Hi, regarding your solution, I extended it a little bit cause the same happens when we want to remove all items. In the visual percept it is fine, it removes all the elements (visually) but when performing the HTTP POST the state is not present in the request. Keeping the same idea, I just added the following line of code:
In summary, it makes the remove or discard all bottom work as expected. |
I've a selectbox with option-tags.
Than I am selecting one entry with this plugin, but the correct option-tag don't get the property "selected". This is not connected.
I added this feature on this way
` multiSelect.subscribe(function(event) {
switch (event.action) {
case 'ADD_OPTION':
$(selectorString + " option[value='" + event.value + "']").prop('selected', 'selected');
break;
The text was updated successfully, but these errors were encountered: