Showing query result in multiple pages instead of just put them all in one long page

Yes if you use a repeating panel, no if you use a DataGrid and enable pagination.

The server callable doesn’t return a list of rows, it returns a smart iterator object that will lazily load what’s needed in chunks of (I think) 100 rows at a time. The DataGrid will show the first page, then, if you go the the next page and enough rows are already loaded, they are immediately shown, otherwise it will automatically load the next chunk of 100 and show the next page.

If you try to access the last page, you could have the problem you mentioned, because the iterator will load all rows and finally show the last page.

You could have more control by hiding the automatic buttons and creating your own.

And you could have even more control by returning lists rather than iterator objects. In this case you could tell the server function what page to return and only return the rows you need.

There are even more advanced approaches. See here for one example: Auto Scroll - Automatically add content as the user scrolls the mouse wheel

2 Likes