Open
Description
I did:
- [x ] Search for if my issue has already been submitted
- [x ] Make sure I'm reporting something precise that needs to be fixed
- [x ] Give my issue a descriptive and concise title
- Create a minimal working example on JsFiddle or Codepen
(or gave a link to a demo on the Selectize docs) - [x ] Indicate precise steps to reproduce in numbers and the result,
like below
I have a selectize dropdown that is loaded with Ajax at document ready. The options are well added, and can be selected by user.
But I have another function that loads the already selected option via another ajax when the modal (where the dropdown is) is shown, and after the options are loaded. But in doing so, all the options are removed from the dropdown.
I tried from the console this line:
jQuery('.targetSel.responsible').selectize()[0].selectize.addItem(912);
The idea was to select the corresponding option (that is the right value of one option of the dropwdown).
Steps to reproduce:
- Add options with AJAX at jQuery(document).ready()
- Open a modal that must have the dropdown
- Call a function where the modal is opened that uses .addItem() method to select the already saved items
Expected result:
The items saved on database are selected based on value
Actual result:
The options are removed