multiselect
multiselect copied to clipboard
Is there a way to dynamically add items after the multiselect has initialized?
For example, I have a modal window with a select list inside of it. I'm using C# and the list gets populated with options from a callback response inside of a jquery click event. After the list is populated I have the modal actually display with the list of items. The problem is that $(#id).multiselect() must be called before the click event, and cannot be called inside of it (the multiselect plugin has no width and is scrunched up to the left of the modal window if I do call it inside of the click event).
Since the original select list gets populated after the multiselect is called, nothing gets added to the multiselect list. So is there anyway I can add select options to the multiselect after all of that, or is there some way around this?
Thanks
Hi Kramerica: Have you found a way to accomplish the task in your comment above?
I found another multiselect jquery plugin with a refresh method but I would like to use this one.
Regards:
Paul
Have you had any success dealing with this issue?
I had to leave it at this moment because a have a deadline with the customer, I use another control (not a jquery widget), I will return to this issue in a few weeks, but first I'll study a little bit about jquery widget development
I was able to add items to the select using the following script:
However, I ended up using nested form attributes to add new records in the system more easily. See https://github.com/bbuchalter/complex-form-examples/tree/unobtrusive-jquery-deep-rails3