Open chandang-Chetu opened 4 years ago
Are you still looking for an answer?? I had the same problem and my dirty solution was to put my select within a div, and every time I need to refresh the multiSelect I empty the div, insert the html with the same select and then use .multiSelect again
Thanks for your answer. It was really helpful. We were scratching our heads from a long time.
Does anyone has a cleaner solution?
The following worked for me, mid-2024.
<div id="projects_dropdown">
<select size="5" name="projectid" id="project_select" class="selectpicker" multiple>
<option value="value1">Value 1</option>
<option value="hello there">hello there</option></select>
</div>
# append a new element to the original, hidden select list
$('#project_select').append($('<option/>', { value: 'hi', text : 'hi' }));
# remove the multiselect from the DOM
$('#projects_dropdown .multi-select-container').remove();
# re-initialize it.
$('#projectid').data("plugin_multiSelect").init();
Hi,
I need to refresh ,rebuild or destroy previous and bind new multiselect.
I used $("#MymultiselectId").multiSelect('destroy') , $("#MymultiselectId").multiSelect('refresh'), and $("#MymultiselectId").multiSelect('rebuild'). But can not refresh or rebind the multiselect on dropdown rebind.
Please let us know what should i use.
Thanks.