# How to make our grid pagination update automatically when page loads:

softteam
130 1 8

Hi,

I am using a own pagination in a grid component and I would like to know how can I make the pageSize update automatically based on the number of records being displayed on the screen? Because until I perfom an action in the screen the pageSize isn’t updated. The code I am using is the following:

Zul:

Java controller:

Here I have the method that is executed with the AfterCompose event, where I indicate the pageSize that the pagination will have, which will be the one that the grid has, by default 20.

When we load the page it shows us the pageSize with 20 records, however, if we count the records we see that there are 19.

Instead, if you change the page it is automatically updated to the number of records that fit on the screen:

delete retag edit

Sort by » oldest newest most voted

hawk
3048 1 5
http://hawkphoenix.blogsp...

I saw you have specified autopaging="true" and vflex="true", Grid will determine its page size automatically according to available height. Hence, you can't change the page size by setPageSize().

You mentioned:

how can I make the pageSize update automatically based on the number of records being displayed on the screen?

As I understand, what you want is exactly what autopaging="true" does. You need to change the height to change the number of records to display.

[hide preview]