Results 1 to 4 of 4

Thread: Paging doesn't work

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    8
    Vote Rating
    3
      0  

    Default Answered: Paging doesn't work

    Hi there,

    I followed the PagingGridExample.java from the explorer demo. The code is exactly the same, except that I am using my own DataItem instead of Post. As well, instead of being its own class, I just have a method "createTable()" 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:

    Code:
    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:

    Code:
    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.jpg

  2. Let's break this down into the two issues you mention: 1) pagination, and 2) layout.

    Pagination:

    I suspect you are loading all 28 items in to your list store. I've only used remote loaded grids and I believe that the grid will not magically paginate, but rather will, assuming you are using a proxy, send the PagingLoadConfig (or FilterPagingLoadConfig) to the server and the onus is on your servlet and/or business logic to read the limit and offset and only send those items back, along with a total count.

    Layout:

    You are telling the paging tool bar to take up 20% of the container and it likely doesn't need that much. Try using a 1, -1 for your paging tool bar and change your grid to a 1, 1. This will tell the outer container to use the actual height of the paging tool bar and tell the grid to use the rest.

    Alternatively, you could use a FlowLayoutContainer, but you will need to ensure that the added items have size and position because FlowLayoutContainer (along with CssFloatLayoutContainer) do not size or position its children.

  3. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20
    Vote Rating
    21
      1  

    Default

    Let's break this down into the two issues you mention: 1) pagination, and 2) layout.

    Pagination:

    I suspect you are loading all 28 items in to your list store. I've only used remote loaded grids and I believe that the grid will not magically paginate, but rather will, assuming you are using a proxy, send the PagingLoadConfig (or FilterPagingLoadConfig) to the server and the onus is on your servlet and/or business logic to read the limit and offset and only send those items back, along with a total count.

    Layout:

    You are telling the paging tool bar to take up 20% of the container and it likely doesn't need that much. Try using a 1, -1 for your paging tool bar and change your grid to a 1, 1. This will tell the outer container to use the actual height of the paging tool bar and tell the grid to use the rest.

    Alternatively, you could use a FlowLayoutContainer, but you will need to ensure that the added items have size and position because FlowLayoutContainer (along with CssFloatLayoutContainer) do not size or position its children.

  4. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    8
    Vote Rating
    3
      1  

    Default

    That worked perfectly! I didn't realize that I had to give the list store the size of chunks that I wanted. For the other issue, I had changed it originally to 80% and 20% because I couldn't see it otherwise. But after fixing the paging issue, I changed it back to the values you suggested and the table shows perfectly.

    Thanks!

  5. #4
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    413
    Answers
    20
    Vote Rating
    21
      0  

    Default

    you're welcome and glad to help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •