ehynds/jquery-ui-multiselect-widget — Issue #232: Feature Request: Collapsable opt groups
Author: bigcmos
Created: 2012-03-02 19:53:24+00:00
State: open

Would like this as an option on the multiselect.

// Make Optgroups collapsible.
var optgroups = $('li.ui-multiselect-optgroup-label').prepend(
'');
optgroups.find('span').click(function() {
$(this).toggleClass('ui-icon-triangle-1-s ui-icon-triangle-1-e'); // ui-icon-triangle-1-s ui-icon-triangle-1-e from jquery-ui
var toggle = $(this).hasClass('ui-icon-triangle-1-s');
$(this).parent().nextUntil('li.ui-multiselect-optgroup-label').toggle(
toggle);
});