I was having issues with the select's "change" event being triggered during initialization. This was interfering with other functionality in my app.
I've made the following changes to the source to resolve this issue.
Starting at line 157
// update count
this._updateCount();
that._filter.apply(this.availableContainer.find('input.search'), [that.availableList]);
},
_updateCount: function() {
this.element.trigger('change');
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
},
I've changed it to
// update count
this._updateCount(false);
that._filter.apply(this.availableContainer.find('input.search'), [that.availableList]);
},
_updateCount: function(trigger) {
trigger = typeof trigger !== 'undefined' ? trigger : true;
if(trigger)
this.element.trigger('change');
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
},
This change leaves the count update in place, but avoids the extra initial trigger of the "change" event for the select.
I'm sure that there are better ways to implement this, but it works for me.
I was having issues with the select's "change" event being triggered during initialization. This was interfering with other functionality in my app.
I've made the following changes to the source to resolve this issue.
Starting at line 157
I've changed it to
This change leaves the count update in place, but avoids the extra initial trigger of the "change" event for the select.
I'm sure that there are better ways to implement this, but it works for me.