You found a bug! We've classified it as EXTGWT-2120 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    4
    Vote Rating
    0
    florian.trossbach is on a distinguished road

      0  

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

    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
    WesleyMoy is on a distinguished road

      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
    cybercox is on a distinguished road

      0  

    Default Any news on this?

    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 - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      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
    cybercox is on a distinguished road

      0  

    Default It worked!

    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);