Removing a selected Item from AutoCompleteTextView

nativescriptcore

#1

Hi,

I want to hide/remove items from an autocomplete which has been selected (that is, when a token is added), so that user cannot add the same token again. Can somebody suggest some idea how can I achieve this? I am using vanilla javascript. Thanks.


#2

Removing items is part of the AutoCompleteTextView component (the little x next to a selected item). If you want to prevent them from adding the same item again, I think you’d have to track previously added items in an array and then search the array if/when they try to re-add the item?


#3

Yeah, that’s my workaround for now. I am removing the previously added token when the similar one is selected again. :relieved: