PDA

View Full Version : consistent # of rows for grid with pagination



paulwang727
11 Sep 2008, 6:53 AM
I am using a grid with paging enabled. However, when the grid moves to the last page it only has 2 out of the 10 rows (because it has 12 rows total) and thus pushes the pagingBar back up. I was wondering if I could pad the grid with blank rows for the last element so that it will have a consistent height of 10 rows.

If anyone has any suggestions I would really appreciate it.
Thanks.

mabello
11 Sep 2008, 7:08 AM
I think that if you put your grid in the center region of a border layout, you can fix this.
I hope this helps

devnull
11 Sep 2008, 7:09 AM
Yep this has to do with the grid's container in the layout. If you are still having problems it would help for us to see the grid config and at least some of the surrounding layout.

Darklight
11 Sep 2008, 7:46 AM
easiest way would be to do it in your backend (if less than 10 records, select and return 10)

paulwang727
11 Sep 2008, 1:10 PM
I created a form that contains a grid and a form (exactly the same as this: http://extjs.com/deploy/dev/examples/form/form-grid.html (dynamic grid binded to a form). Instead of inserting rows can I set the grid height to a specific size so the paging toolbar would not push up?

How can I get the paging toolbar to stay in a specific location without messing with the backend ?

devnull
11 Sep 2008, 1:21 PM
The pagingToolbar should be either at the top (tbar) or bottom (bbar) of the grid depending on which toolbar location you assign it to. The height of the grid depends on its configured height, or the height of the container if using a fit type layout. The height is never controlled by how many records it contains, nor anything else that comes from the server so I do not understand what the problem is.

paulwang727
11 Sep 2008, 1:33 PM
@devnull

You are completely right. Grid defaults to autoHeight and as long as I give it a specific height the pagingToolbar never moves when it's at the bottom (bbar). Thanks