diff options
author | lou <louiscuny@gmail.com> | 2014-07-16 17:30:45 +0200 |
---|---|---|
committer | lou <louiscuny@gmail.com> | 2014-07-16 17:31:00 +0200 |
commit | 058c212f09cf70079cf2a6e48d4cc5c4412a2a73 (patch) | |
tree | 63dbc240994524327e119b6a254ff5b6212fbfa6 | |
parent | 5839faff662759b429f79c6fb42c8c62fa3b8f2d (diff) | |
download | multi-select-058c212f09cf70079cf2a6e48d4cc5c4412a2a73.zip multi-select-058c212f09cf70079cf2a6e48d4cc5c4412a2a73.tar.gz multi-select-058c212f09cf70079cf2a6e48d4cc5c4412a2a73.tar.bz2 |
do not select/deselect disabled elems on optgroup click (fix #141)
-rw-r--r-- | js/jquery.multi-select.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js index 08a2e06..3bdfb2b 100644 --- a/js/jquery.multi-select.js +++ b/js/jquery.multi-select.js @@ -149,11 +149,11 @@ $selectionOptgroup.append($(optgroupTpl)); if (that.options.selectableOptgroup){ $selectableOptgroup.find('.ms-optgroup-label').on('click', function(){ - var values = $optgroup.children(':not(:selected)').map(function(){ return $(this).val() }).get(); + var values = $optgroup.children(':not(:selected, :disabled)').map(function(){ return $(this).val() }).get(); that.select(values); }); $selectionOptgroup.find('.ms-optgroup-label').on('click', function(){ - var values = $optgroup.children(':selected').map(function(){ return $(this).val() }).get(); + var values = $optgroup.children(':selected:not(:disabled)').map(function(){ return $(this).val() }).get(); that.deselect(values); }); } @@ -325,8 +325,8 @@ var lastMovedDom = false; $list.on('mousemove', function(){ if (lastMovedDom === this) return; - lastMovedDom = this; - var elems = $list.find(that.elemsSelector); + lastMovedDom = this; + var elems = $list.find(that.elemsSelector); elems.on('mouseenter', function(){ elems.removeClass('ms-hover'); |