Open justingolden21 opened 6 months ago
If your autoComplete instance is assigned to a variable called autoCompleteJS
then you should be able to access it:
In my case, each item in my data source is an object { key: 'MyKey", value: 'MyValue' }
events: {
input: {
selection: (event) => {
const { selection } = event.detail
console.log(selection.value) // the entry that was selected, either the string value or the object from your array
searchField.input.value = selection.value.key // I'm then accessing my key property
}
}
}
In your example you're trying to access the an index on selected value as if its an array.
Is your feature request related to a problem? Please describe.
It was difficult to figure out how to programmatically get the resulting selection when an autocomplete item is selected.
Thoroughly Describe the solution you'd like
Documentation on the
selection
event. Same code:Please provide a few use cases for this feature
Please Describe alternatives you've considered
I searched through the docs on configuration and was unable to find it: