I can't change the data list at run time #305
Answered
by
folknor
adilorenzo10
asked this question in
Q&A
-
Hi everyone, I have a problem.
|
Beta Was this translation helpful? Give feedback.
Answered by
folknor
Dec 21, 2021
Replies: 1 comment 3 replies
-
So you are creating a new const autoCompleteJS = new autoComplete({
placeHolder: "Cerca una categoria...",
data: {
src: function (query) {
if (document.querySelector('input[name="sel-tipo-annuncio"]:checked').value == 'Bene') {
return passedArrayBene.slice();
}
else {
return passedArrayServizio.slice();
}
}
},
resultItem: {
highlight: false
},
events: {
input: {
selection: (event) => {
const selection = event.detail.selection.value;
autoCompleteJS.input.value = selection;
}
}
}
}); |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
adilorenzo10
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So you are creating a new
autoComplete
instance every time the radio selection changes? That's a bad idea. Do this instead: