You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I imagine most programmers will want to do something with the data they select, otherwise there would be no reason to use this library other than for mockups
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:
The text was updated successfully, but these errors were encountered: