Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh or rebind multiselect #19

Open
chandang-Chetu opened this issue Sep 26, 2019 · 4 comments
Open

Refresh or rebind multiselect #19

chandang-Chetu opened this issue Sep 26, 2019 · 4 comments

Comments

@chandang-Chetu
Copy link

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.

@hedka77
Copy link

hedka77 commented Jun 1, 2021

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

@gadeutham2000
Copy link

Thanks for your answer. It was really helpful. We were scratching our heads from a long time.

@gregfr
Copy link

gregfr commented Jun 8, 2022

Does anyone has a cleaner solution?

@DreadPirateFlint
Copy link

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants