ehynds/jquery-ui-multiselect-widget — Issue #200: multiselect - not selecting items when optgroup title is clicked
Author: Zehzen
Created: 2011-12-16 16:49:56+00:00
State: open

I recently downloaded the new 1.12 version of the multiselect widget and was having a problem with it not selecting the checkboxes when I click on the optgroup title. I'm using IE 8, Windows XP SP 3, and the 1.12 multiselect widget. I also tested this issue in Firefox and it worked correctly so I starting looking to see if I could figure out what was wrong. The issue was in the file jquery.multiselect.filter.js line 73 char 5 which is the line:

$inputs = $inputs.not( selector ).each(this._toggleState('checked', flag));

For some reason in IE the property this._toggleState was undefined but existed in Firefox. So I changed line 73 to the following code:

this._toggleState = function (prop, flag) {
return function () {if (!this.disabled) {this[prop] = flag;}if (flag) {this.setAttribute("aria-selected", true);} else {this.removeAttribute("aria-selected");}};
}
$inputs = $inputs.not( selector ).each(this._toggleState('checked', flag));

Once that code was in place the multiselect worked properly in IE and Firefox.