WebListBox Loading and Searching

On one of my pages for my web app, I have a segmented button with 3 segments, a search field, and a list box. My goal is to use the segmented button to change the list shown using a single listbox. These lists will also be big enough that users will need the ability to search them.

So far, I have just a few rows of data that I’m manually adding to the listbox as I test and get the functionality I want, then I will add the real data using an SQLite database and populate the list from that. Switching between segments on my button will remove the rows and then add the new rows and that part is working just fine it seems.

To search, I am getting the text from my search box and using the SearchCriteria method of the WebListBox. This works to search, but only on the first load of any of my lists. Once I switch to a different list and then back again, the search is broken. At this point, the code breaks automatically, but I’m not given any errors to work with or debug info.

I’ve given my code below, but it’s been generalized to make it easier to understand.

Here’s my code for when a segment on the button is pressed (this is also called on open to set the list the first time):
ListBox.SearchCriteria = “”

SetList(ListSelectionBtn.SelectedSegmentIndex) //method used to set the list with the segmented button index passed as a parameter

Here’s my code in the SetList method for setting the lists in the listbox:
ListBox.RemoveAllRows

Select Case segmentIndex
Case Mode1
ListBox.AddRow(“some string”) 'repeated 5 times

Case TropicalsPlantMode
ListBox.AddRow(“some string”) 'repeated 5 times

Case BaileysPlantMode
ListBox.AddRow(“some string”) 'repeated 5 times

End Select

Here’s my code when the pressed event is called on the search field:
ListBox.SearchCriteria = SearchField.Text

Is this just a bug with Web 2.0 or is there something else I’m missing when removing and re-adding the rows? I’ve looked around everywhere I can and can’t seem to find much details on the “proper” way to do what I’m trying to do or use SearchCriteria.

Have you looked into webdatasource ?

https://docs.xojo.com/WebDataSource

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.