From 6e8e2d6d947228cf502c3209a07297a229034025 Mon Sep 17 00:00:00 2001 From: Miguel Gonzalez Date: Mon, 21 Mar 2022 12:07:07 -0600 Subject: [PATCH] Fix After unselect an item, no update selected items --- ui.dropdownchecklist.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui.dropdownchecklist.js b/ui.dropdownchecklist.js index 7c7a1e5..93ecc7c 100644 --- a/ui.dropdownchecklist.js +++ b/ui.dropdownchecklist.js @@ -94,7 +94,7 @@ item.css({whiteSpace: "nowrap"}); // the checkbox var checkedString = checked ? ' checked="checked"' : ''; - var checkBox = $('') + var checkBox = $('') .attr("index", index) .val(value); if (exclusive) { @@ -238,8 +238,13 @@ // do the actual synch with the source select var selectOptions = sourceSelect.get(0).options; - allCheckboxes.each(function(index) { + allCheckboxes.each(function (index) { + if ($(this).attr("checked") == "checked") { $(selectOptions[index]).attr("selected", $(this).attr("checked")); + } + else { + $(selectOptions[index]).attr("selected", null); + } }); // update the text shown in the control @@ -280,8 +285,9 @@ } else { // concatenate the text from the checked items text = ""; - selectOptions.each(function() { - if ($(this).attr("selected")) { + + selectOptions.each(function () { + if ($(this).attr("selected") == 'selected') { text += $(this).text() + ", "; } });