I use the selectize.js with remove-button Plugin. I fill the options dynmaicly based on Users decisions. By Buttonclick i add a new Option.
$('#saveItem').click(function(){
data = [{item: 'newItem', nr: 'R005'}];
var selectize = $item[0].selectize;
selectize.addOption(data);
selectize.addItem(data);
selectize.refreshOptions();
});
When the user now select the option from the list and later he removes the option from the Inputfield than the option is gone.
Only my inital options are in the optionlist. How can i store the dynamic generated options?
I have a fiddle. There can u see that I get a "Option" newItem by button Click. But when i select and then remove them the "Option" is'nt longer in the option list. Where is my fault?
https://jsfiddle.net/gwmkmb7r/1/
This functionality is now added into newer version
Just use plugins: ['remove_button']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With