yanickrochon/jquery.uix.multiselect

Dynamically updating optgroups leaves old optgroup headers

mutatron opened this issue · 0 comments

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.