Problems with paging using Sencha GXT grid and paging tool bar

2,146 views
Skip to first unread message

CF

unread,
Aug 7, 2012, 1:22:34 PM8/7/12
to google-we...@googlegroups.com
Hi there,

I was wondering if anyone here uses Sencha GXT and could help me.  The Sencha GXT forums are not very active...

I followed the PagingGridExample.java from the Explorer demo: http://www.sencha.com/examples/#ExamplePlace:paginggrid. The code I use is exactly the same, except that I am using my own "DataItem" instead of "Post". As well, instead of a separate PagingGridExample class, I just have a method "createTable()" inside another class that runs the code found inside PagingGridExample.java asWidget() . I'm having a few problems with it though.

The grid loads, however paging doesn't work. I set: 
final PagingToolBar pagingToolBar = new PagingToolBar(10);
However, even though the toolbar shows and shows the text: "Displaying 11 - 20 of 28", etc, the grid shows all 28 rows. When I click the buttons in the paging toolbar, the grid refreshes, but still shows all 28 rows on each page.

Also, the paging tool bar is unusually thick. I have to change the parameters of the VerticalLayoutData in order for it to show at all:
VerticalLayoutContainer con = new VerticalLayoutContainer();
        con.setBorders(true);
        con.add(grid, new VerticalLayoutData(1, 0.80));
        con.add(pagingToolBar, new VerticalLayoutData(1, 0.20));
The overall layout is a DockLayoutPanel with a gxt TabPanel in the center. The grid is placed on a tab within a gwt VerticalPanel. All the other code is the same as in the example, except as noted above.

I have attached a screenshot. Would appreciate any help!

Screenshot_grid.png

Giuseppe La Scaleia

unread,
Aug 7, 2012, 4:37:14 PM8/7/12
to google-we...@googlegroups.com
I don't understand your problem. May you ecplain better??
Regards Giuseppe

Inviato da iPhone
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/CW07r5imxcQJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
<Screenshot_grid.png>

CF

unread,
Aug 7, 2012, 4:49:41 PM8/7/12
to google-we...@googlegroups.com
I fixed the problem.  For anyone who's interested, you have to tell the list store the "chunk" of rows you want.  Giving it a PageLoadConfig with an offset is not enough.  This was where my mistake was, I thought that with the config, it would "magically" give me the correct number of rows per page.  Instead, I was loading all of my rows at once.

To fix this, the servlet has to read the limit and offset from the config and only send the correct items back.  Once this was fixed, the thick toolbar issue was also fixed.

See this helpful reply in the Sencha thread: http://www.sencha.com/forum/showthread.php?235846-Paging-doesn-t-work

:)


On Tuesday, August 7, 2012 1:37:14 PM UTC-7, glascaleia wrote:
I don't understand your problem. May you ecplain better??
Regards Giuseppe

Inviato da iPhone

Il giorno 07/ago/2012, alle ore 19:22, CF <michel...@gmail.com> ha scritto:

Hi there,

I was wondering if anyone here uses Sencha GXT and could help me.  The Sencha GXT forums are not very active...

I followed the PagingGridExample.java from the Explorer demo: http://www.sencha.com/examples/#ExamplePlace:paginggrid. The code I use is exactly the same, except that I am using my own "DataItem" instead of "Post". As well, instead of a separate PagingGridExample class, I just have a method "createTable()" inside another class that runs the code found inside PagingGridExample.java asWidget() . I'm having a few problems with it though.

The grid loads, however paging doesn't work. I set: 
final PagingToolBar pagingToolBar = new PagingToolBar(10);
However, even though the toolbar shows and shows the text: "Displaying 11 - 20 of 28", etc, the grid shows all 28 rows. When I click the buttons in the paging toolbar, the grid refreshes, but still shows all 28 rows on each page.

Also, the paging tool bar is unusually thick. I have to change the parameters of the VerticalLayoutData in order for it to show at all:
VerticalLayoutContainer con = new VerticalLayoutContainer();
        con.setBorders(true);
        con.add(grid, new VerticalLayoutData(1, 0.80));
        con.add(pagingToolBar, new VerticalLayoutData(1, 0.20));
The overall layout is a DockLayoutPanel with a gxt TabPanel in the center. The grid is placed on a tab within a gwt VerticalPanel. All the other code is the same as in the example, except as noted above.

I have attached a screenshot. Would appreciate any help!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/CW07r5imxcQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
<Screenshot_grid.png>
Reply all
Reply to author
Forward
0 new messages