wenzhixin / multiple-select

A jQuery plugin to select multiple elements with checkboxes :)
http://multiple-select.wenzhixin.net.cn
MIT License
1.91k stars 652 forks source link

Reset functionality not available #544

Closed salewi closed 4 years ago

salewi commented 4 years ago

Hello, I have been using multipleSelect for a while now. I am running into a problem following a client's ask. The clients wants the multiple select options to be populated by data from an Ajax call following a change in a particular field. However, I cannot get the mutlipleSelect to reset all the values inorder to populate it with the new values from an Ajax call. I've looked everywhere including trying to add a remove option on the core file, is there a way to reset/remove all the options values?

wenzhixin commented 4 years ago

You can use the data option and the refreshOptions method to solve your problem.

Online example: http://multiple-select-live.wenzhixin.net.cn/code/wenzhixin/2764

salewi commented 4 years ago

Awesome, thank you! I ended up using modifying the core files since we were using an old version of your plugin --

wenzhixin commented 4 years ago

You can use the refresh method if you are using an old version: http://multiple-select.wenzhixin.net.cn/examples#refresh.html