How to change the transmitted parameter?
Suppose I initialize a library with parameters:
const instances = multipleSelect.map((element) => {
let init = new Choices(element, {
searchEnabled: true,
itemSelectText: '',
removeItemButton: true,
shouldSort: true,
noChoicesText: 'None'
})
})
How can I change parameters during an event change, for example, from searchEnabled: true to searchEnabled: false or add a new/delete parameter.
I run it:
const instances = multipleSelect.map((element) => {
let init = new Choices(element, {
searchEnabled: true,
itemSelectText: '',
removeItemButton: true,
shouldSort: true,
noChoicesText: 'None',
})
element.addEventListener('change', (event) => {
// here I want to change from "searchEnabled: true" to "searchEnabled: false"
})
})
That is, I want the parameters to change during the event
So? Anyone have solution or variant how this done? I want to dynamically change some config options like removeItemButton, searchPlaceholderValue, but can't see where I can do that((
So? Anyone have solution or variant how this done? I want to dynamically change some config options like removeItemButton, searchPlaceholderValue, but can't see where I can do that((
there is no convenient solution. You need to store instances of the selects you want to change. And kill it with destroy(), and then re-initialize it with the required parameters