1. #1
    Ext User
    Join Date
    Feb 2009
    Posts
    16
    Vote Rating
    0
    piff62 is on a distinguished road

      0  

    Default Problem with GridFilters

    Problem with GridFilters


    Hello,

    I post here because I have a problem with the GridFilters plugin.

    I have a "bug" when i am at a page different of the first page.

    For example, if i'm at the 7th page.
    When I add a filter .. I stay at the 7th page but the result is at the first page.

    How can i do to rewind to the first page if i apply a filter ?

    Thanks!

    piff62

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    I had the same problem, easy fix, but was really hard to figure out originally. Can't believe no one has helped you with this yet. Just in case you still need it, or anyone else needs it, here it is:


    yourgrid.store.on('load', assureExistingPage);
    function assureExistingPage()
    {
    var currentPageNumber = tb.readPage();
    var maximumPageNumber = Math.floor(tb.store.getTotalCount() / tb.pageSize) + 1;
    if(currentPageNumber > maximumPageNumber)
    tb.changePage(maximumPageNumber);
    }

    where yourgrid is the grid
    and tb is the Ext.PagingToolbar in the grid

    I don't know if this will work for Ext 2.0, but it definately works for 3.2.1

Thread Participants: 1