Skip to content

Commit

Permalink
call the callbacks methods on select_all/deselect_all methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lou committed Jan 9, 2013
1 parent c2c8169 commit 3a4636e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions js/jquery.multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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){
Expand Down

0 comments on commit 3a4636e

Please sign in to comment.