Results 1 to 6 of 6

Thread: PagingToolBar failure when changing page size dynamically

  1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    14
    Vote Rating
    0
      0  

    Exclamation PagingToolBar failure when changing page size dynamically

    I believe this is really a bug - but I cannot file it as one until I have time to create a sample according to the guidelines.

    Anyway, I am using the PageSizePlugin (http://www.extjs.com/forum/showthread.php?t=81975) and I have a total number of records = 13. The pageSize is initially set to 5. The toolbar is showing 'Page 1 of 3' and 'Displaying 1 - 5 of 13'.

    If I click next i.e changing the page to 'Page 2 of 3' and 'Displaying 6 - 10 of 13' everything is fine.

    But if I then change the pagingSize to 100. I get the following toolbar display: 'Page 2 of 1' and 'Displaying 6 - 105 of 13'

    Now I fixed that by overriding the onLoad(LoadEvent) method in my own subclass of the PagingToolbar. Below are my changes...

    PHP Code:
            ...
            PagingLoadResult<?> result = event.getData();
            start = result.getOffset();
            totalLength = result.getTotalLength();
            if (totalLength < pageSize) {
                activePage = 1;
                start = 0;
            } else {
                activePage = (int) Math.ceil((double) (start + pageSize) / pageSize);
            }
            pageText.setText(String.valueOf((int) activePage));
            ...
    Attached Images Attached Images

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    The issue will be that your loadconfig still returns some offset.

  3. #3
    Ext User
    Join Date
    Apr 2007
    Posts
    14
    Vote Rating
    0
      0  

    Default

    Let me give it a spin with GXT 2.0.2 and see what happens.

  4. #4
    Ext User
    Join Date
    Apr 2007
    Posts
    14
    Vote Rating
    0
      0  

    Default

    I still don't understand really. All I do is toolbar.setPageSize(100) and toolbar.refresh(). As a user I do not have access to the loadconfig in use? In the PagingToolbar the line causing the problem is this one:

    PHP Code:
    activePage = (int) Math.ceil((double) (start pageSize) / pageSize); 
    PHP Code:
    activePage = (int) Math.ceil((double) (100 100);  // equals page 2 (should be 1) 

  5. #5
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    The suggest fix is not fixing it. Also you cannot just set start to 0. It may fix your issue, but not the overall problem.


    The problem is that there is still some offset set. So on the server you request data 5 to 105. and not 0 to 100.

    Pagingtoolbar is not designed to handle this.

  6. #6
    Ext User
    Join Date
    Apr 2007
    Posts
    14
    Vote Rating
    0
      0  

    Default

    You are right. My request is wrong

    [INFO] 200 - GET /service/rs/role?limit=100&offset=5&sortDir=NONE (127.0.0.1) 488 bytes

Posting Permissions

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