Skip to content

Commit 6744477

Browse files
author
ehynds
committed
make sure the filter widget triggers the change event as well. fixes #247
1 parent ed89b50 commit 6744477

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/jquery.multiselect.filter.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,19 @@
5959
// rewrite internal _toggleChecked fn so that when checkAll/uncheckAll is fired,
6060
// only the currently filtered elements are checked
6161
instance._toggleChecked = function(flag, group){
62-
var $inputs = (group && group.length) ?
63-
group :
64-
this.labels.find('input'),
65-
66-
_self = this,
67-
68-
// do not include hidden elems if the menu isn't open.
69-
selector = self.instance._isOpen ?
70-
":disabled, :hidden" :
71-
":disabled";
62+
var $inputs = (group && group.length) ? group : this.labels.find('input');
63+
var _self = this;
64+
// do not include hidden elems if the menu isn't open.
65+
var selector = self.instance._isOpen ? ":disabled, :hidden" : ":disabled";
7266

73-
$inputs = $inputs.not( selector ).each(this._toggleState('checked', flag));
67+
$inputs = $inputs
68+
.not( selector )
69+
.each(this._toggleState('checked', flag));
7470

7571
// update text
7672
this.update();
7773

78-
// figure out which option tags need to be selected
74+
// gather an array of the values that actually changed
7975
var values = $inputs.map(function(){
8076
return this.value;
8177
}).get();
@@ -88,6 +84,11 @@
8884
_self._toggleState('selected', flag).call( this );
8985
}
9086
});
87+
88+
// trigger the change event on the select
89+
if($inputs.length) {
90+
this.element.trigger("change");
91+
}
9192
};
9293

9394
// rebuild cache when multiselect is updated

0 commit comments

Comments
 (0)