summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorlou <louiscuny@gmail.com>2013-01-09 10:54:47 +0100
committerlou <louiscuny@gmail.com>2013-01-09 10:54:47 +0100
commit3a4636ee07b96e1f0cb34d5aea5fb5a709a75d25 (patch)
tree8708f3c3e58d8b120db874e47ee8d247d7f2c368 /js
parentc2c8169e8c40d1f86f27983fae54b225fb84cb05 (diff)
downloadmulti-select-3a4636ee07b96e1f0cb34d5aea5fb5a709a75d25.zip
multi-select-3a4636ee07b96e1f0cb34d5aea5fb5a709a75d25.tar.gz
multi-select-3a4636ee07b96e1f0cb34d5aea5fb5a709a75d25.tar.bz2
call the callbacks methods on select_all/deselect_all methods
Diffstat (limited to 'js')
-rw-r--r--js/jquery.multi-select.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js
index d694cf4..f1a57ca 100644
--- a/js/jquery.multi-select.js
+++ b/js/jquery.multi-select.js
@@ -381,7 +381,8 @@
},
'select_all' : function(){
- var ms = this.$element;
+ var ms = this.$element,
+ values = ms.val();
ms.find('option').prop('selected', true);
this.$selectableUl.find('.ms-elem-selectable').addClass('ms-selected').hide();
@@ -391,10 +392,17 @@
this.$selectionUl.focusin();
this.$selectableUl.focusout();
ms.trigger('change');
+ if (typeof this.options.afterSelect == 'function') {
+ var selectedValues = $.grep(ms.val(), function(item){
+ return $.inArray(item, values) < 0;
+ });
+ this.options.afterSelect.call(this, selectedValues);
+ }
},
'deselect_all' : function(){
- var ms = this.$element;
+ var ms = this.$element,
+ values = ms.val();
ms.find('option').prop('selected', false);
this.$selectableUl.find('.ms-elem-selectable').removeClass('ms-selected').show();
@@ -404,6 +412,9 @@
this.$selectableUl.focusin();
this.$selectionUl.focusout();
ms.trigger('change');
+ if (typeof this.options.afterDeselect == 'function') {
+ this.options.afterDeselect.call(this, values);
+ }
},
isDomNode: function (attr){