Results 1 to 5 of 5

Thread: Remotely filtered paging grid does not reset offset on filter activation

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default Remotely filtered paging grid does not reset offset on filter activation

    Required Information Version(s) of Ext GWT
    EXT GWT 3.0.0 RC2

    Browser versions and OS
    (and desktop environment, if applicable)
    • Firefox 11, Windows 7
    • Firefox 10, Windows XP

    Virtual Machine
    No

    Description

    If you have a grid with paging and remote filtering, the offset is not reset to 0 when the filter configuration is changed.
    Example: You are on page 2 of a yet unfiltered grid, and then eliminate all but one row due to a filter.
    You are then going to be stuck in page 2 with the old total count, which will only adapt if you go back to page 1. I don't think this is the expected behaviour.

    Run mode
    Both

    Steps to reproduce the problem

    1. Go to http://sencha.com/examples-dev/#Exam...motefiltergrid
    2. Go to page 2 in the grid
    3. Add a filter in column "Company" saying "Pfizer"

    Expected result
    You should immediately see the Pfizer entry on page 1, "Displaying 1 - 1 of 1"

    Actual result

    You see an empty page 2 with an incorrect count saying "Displaying 26 - 44 of 44".
    Everything gets corrected if you go to page 1 manually

    Test case

    Source code of http://sencha.com/examples-dev/#Exam...motefiltergrid

    Live test
    http://sencha.com/examples-dev/#Exam...motefiltergrid

  2. #2
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
      0  

    Default

    Thanks for pointing this out. I've filed a ticket against the team and will have them take a look.

  3. #3
    Sencha User
    Join Date
    Oct 2013
    Posts
    2
    Vote Rating
    0
      0  

    Default Any news on this?

    Hi!
    i've got the same problem here... is there anything i can do to avoid this behaviour?
    TKS

  4. #4
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      0  

    Default

    Try this: instead of sending back zero items, send back the previous page of items that was valid, with the corresponding totalCount, offset etc. If that doesnt work (i.e. the client gets confused about what it got back), you can listen for LoadEvents and based on the new totalCount, get the last possible page based on current pagesize.

  5. #5
    Sencha User
    Join Date
    Oct 2013
    Posts
    2
    Vote Rating
    0
      0  

    Default It worked!

    First of all: THANK YOU COLIN!

    As you can imagine.... it worked.

    We are remotely filtering the data and prior to your suggestion we had the following code, assuming that we want to paginate an ArrayList:
    Code:
            List<T> sublist = new ArrayList<T>();
            int start = myOffset;
            int limit = itemsToPaginate.size();
            if (myLimit != null && myLimit > 0) {
                limit = Math.min(start + myLimit, limit);
            }
            for (int i = myOffset; i < limit; i++) {
                sublist.add(itemsToPaginate.get(i));
            }
            return new PagingLoadResultBean<T>(sublist, itemsToPaginate.size(), myOffset);
    now the working code is
    Code:
            ArrayList<T> sublist = new ArrayList<T>();
            int start = myOffset;
            int limit = itemsToPaginate.size();
            if(start>limit){
                // This means that we are asking for something that does not exists!
                // We force the dataset to begin at offset 0
                start = 0;
            }
            if (myLimit != null && myLimit > 0) {
                limit = Math.min(start + myLimit, limit);
            }
            for (int i = start; i < limit; i++) {
                sublist.add(itemsToPaginate.get(i));
            }
            return new PagingLoadResultBean<T>(sublist, itemsToPaginate.size(), start);

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
  •