I have a selectize control with 100 items.
I want the control to show the dropdown only when typing.
- When it gets focus the dropdown should be closed
- openOnFocus: false
- When an item is selected the dropdown should be closed
- closeAfterSelect: true
- When an item is selected using tab the dropdown should be closed
- When an item is deleted with backspace the dropdown should be closed
- When an item is deleted with x(remove plugin) the dropdown should be closed
How do I achieve 3, 4 and 5?
My control settings look like below:
globalSelectizedEditor = $('#tagsEditor').selectize({
plugins: ['remove_button'],
valueField: 'Id',
labelField: 'Name',
searchField: 'Name',
options: [],
create: true,
openOnFocus: false,
persist: false,
closeAfterSelect: true,
render: {
...
},
load: function (query, callback) {
...
},
onItemAdd: function(value) {
...
globalSelectizedEditor[0].selectize.close();
},
onItemRemove: function () {
globalSelectizedEditor[0].selectize.close();
}
});