Commit 7f3e261f authored by David Stutz's avatar David Stutz

Merge pull request #695 from neojin/fix-opt-group-uncheck

fix optgroup uncheck accidentally unchecking its above neighbors
parents 897b6123 1001e6ce
...@@ -804,24 +804,19 @@ ...@@ -804,24 +804,19 @@
// Update the group checkbox based on new selections among the // Update the group checkbox based on new selections among the
// corresponding children. // corresponding children.
$("li input", this.$ul).on("change", $.proxy(function(t) { $("li:not(.multiselect-group) input", this.$ul).on("change", $.proxy(function(t) {
t.stopPropagation(); t.stopPropagation();
var n = $(t.target).closest('li'); var n = $(t.target).closest('li');
var r1 = n.prevUntil("li.multiselect-group", ':not(.disabled)'); var r = n.prev("li.multiselect-group", ':not(.disabled)');
var r2 = n.nextUntil("li.multiselect-group", ':not(.disabled)'); var q = r.nextUntil("li.multiselect-group", ':not(.disabled)');
var s1 = r1.find("input"); var s = q.find("input");
var s2 = r2.find("input");
var i = $(t.target).prop('checked'); var i = $(t.target).prop('checked');
s1.each(function() { s.each(function() {
i = i && $(this).prop("checked");
});
s2.each(function() {
i = i && $(this).prop("checked"); i = i && $(this).prop("checked");
}); });
n.prevAll('.multiselect-group').find('input').prop('checked', i); n.prev('li.multiselect-group').find('input').prop('checked', i);
}, this)); }, this));
$("li.multiselect-all", this.$ul).css('background', '#f3f3f3').css('border-bottom', '1px solid #eaeaea'); $("li.multiselect-all", this.$ul).css('background', '#f3f3f3').css('border-bottom', '1px solid #eaeaea');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment