Xojo2025R2.1: searching WebListBox with DataSource

Assuming WebListBox populated with some data (more than few rows of course) the user would like to click on the list and type few characters/number to find the row matching the criteria. Basically this is about finding row without the need to scroll and “eyeball” the list (note: it is not about rebuilding the list using updated where clause fetching data).

Would that be possible to do in Xojo in the WebApp?

What you need is SearchCriteria

https://documentation.xojo.com/api/user_interface/web/weblistbox.html#:~:text=WebListBox.SearchCriteria-,SearchCriteria,-As%20String

When I check the link I see this as well: “This property is not supported when a WebDataSource is used to display the data.”.

All the WebListBoxes I use are driven by DataSource.

1 Like

You are right, sorry about that.

There are two solutions I think:

  1. Query again your data to filter with the search query.
  2. If your data comes from a remote database / api call /… And takes some time to query, it is faster to cache the result in an in-memory sqlite db and use that db to populate the datasource.

I used #2 in a recent project and the filtering was almost instant.

It’s perfectly possible.
In fact, there are several ways.

  1. Search using SQL. You added a comment that you wouldn’t like this method.
  2. Use a column search and allow the user to specify which column to search.
  3. Find any occurrence in the entire dataset.

Options 2 and 3 work very similarly to the syntax:
SELECT * FROM Table WHERE Field LIKE “%search%”

As I have mentioned, this should simply search for data in the list and select rows, not reloading data into the list from database based on the where clause in the underlying SQL query.

Correct.
That’s why I listed points 2 and 3.

Let me clarify, points 2 and 3 are searches with data loaded into the LISTBOX

Right, though this requires some coding and extra entry field for the search string as bare minimum (assuming the search is on first column). The problem is that some pages have 3 or 4 different lists, so knowing the context (which list to search on) adds another complexity, not to mention layout changes.

Basically I would like the user to click on the row in the list and start typing (this is how it works in desktop app). So I guess this can not be achieved in web app any time soon (if at all).