Custom search listview texbox help

Hello, how are you, community, I have been able to make a search engine for a listview with a texbox and a button that works well, but I need it not to search for what it contains, to only search the list if it starts with a value.


I write in the texbox:

and only those that begin with michel come out

expected result:

Michael Jackson
Michael Jordan

and not

paul michael
charles michael
Michael Jackson
Michael Jordan

If it contains the search text, split the text at space and select the 1st item and again use if this 1st item contains the search text or not

If this 1st item contains the search text then use add items to the list

Two changes you should make.

  1. Initialize that global variable with create empty list (you have added empty string)
  2. In tinydb, if value not found there too you must use create empty list in order to avoid further error
1 Like

I did both steps, but I don’t understand where to place the split, you have a graphic example

contains text piece ?

thanks, that worked for me

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.