I have a weblistbox that at the moment has about 20000 rows. I’m wondering how I could get it to only load 100 rows at a time. And if I click a button load the next 100 rows…
we did before in a project to load in a timer regularly a few more rows.
So when user enters search term, we could do query and just add 50 rows.
Keep the recordset in a property, run timer every few milliseconds and add 50 more rows.
This way list fills instantly and may load thousands of rows over time.
In SQL use the OFFSET command and keep a variable of where you’re up to with the current offset.
or better: don’t For an explanation why and what to use instead see here: http://use-the-index-luke.com/no-offset
Thanks. Great article about why not to use offset.
How are you loading the weblistbox ?
A frequent solution is to load the content into an array, then load the webListBox from the array.
I think the query in a timer to load the next 50 rows based on ID column > Last fetched ID could be good.
Extra arrays are not needed then.
I used OFFSET and LIMIT and have two buttons “PREV” and “NEXT” and it works really well for me…
We use the Offset and Limit commands and have a ‘paging’ control. You set what your MaxRows limit is and the paging control shows you something like this: << 1 2 3 4 5 6 >> . User presses a page number and it reloads the listbox with that page of data.
If you want to learn how do this you can get this as part of our subscription video training at http://xojo.bkeeney.com/XojoTraining/. Over 200 videos, 65+ hours, and most projects come with source you can use in your own project.
I have watched many of the videos and have learned a lot from them. I would recommend them to anyone writing Xojo code.
I have enough info now to move forward.
And I might look into @Bob Keeney training.