yanickrochon / jquery.uix.multiselect

Completely rewritten, multiselect widget with a more concise API
http://mind2soft.com/labs/jquery/multiselect/
MIT License
139 stars 62 forks source link

Dynamically updating optgroups leaves old optgroup headers #80

Open mutatron opened 10 years ago

mutatron commented 10 years ago

This is changed from a previous problem, which I resolved in my own code.

Still, there's this problem of having optgroup headers leftover after changes to the optgroup.

I'm replacing the optgroup using:

jQuery('optgroup#Facebook).replaceWith(json.message.html);
jQuery('#multiselect_simple').multiselect('refresh');

This works, but it leaves the previous optgroup header sitting there. In my app, if you authorize the app to Facebook, you get whatever pages the user has. So you'd start with an optgroup with a single option, which itself contains a button to authorize to Facebook. Then when you authorize, you get options corresponding to the Facebook pages made available by the user. Then you'd have the main Facebook option, plus another option for each page.

That part works excellently, but the header for the former optgroup is left on display after the replacement.