Extending AutoComplete Options
music-mind opened this issue · 7 comments
I have been playing around with the AutoComplete, and was wondering if there is a way to use the Autocomplete to add new items. The onAutoCompleteTyping only exposes the search value; how can I use it to add a new item / listen for keyPress events?
Modified SuperSelectField to do so in a fork.
erm adding items is not the responsibility of an Autocomplete.
The onAutoCompleteTyping only exposes the search value; how can I use it to add a new item / listen for keyPress events?
You'll have to implement that in a wrapper above superselectfield, catching the keypress events from onAutoCompleteTyping
, then store that in that wrapper state.
Then add some button so user can "ADD" the stored value, which will actually be merged into SSF's children.
SSF should then display that new value in its options.
SSF is just a display component, with some borderline features like filtering, but that's it.
Yep, I was just wondering if it would be better to make it default. For example, I exposed the onEnter to catch Enter inside onKeyPress to achieve what I wanted. Maybe exposing onKeyPress could add more functionality.
onAutoCompleteTyping
IS onKeyPress
onAutoCompleteTyping
only gives the string though, not the event, so how would that work?
(AutoCompleteText => {...do something})
Try it with a console log you should see the result after each keypress, is not what you are searching for ?
closing, since nothing new