extjspaginationextjs3

get current page of paging toolbar ext js 3.4


I'm using EXT JS 3.4

How can i get the current page of the Paging Toolbar?

For example paging toolbar says page 7 of 10. How can I get the value '7' because I will need the current page value after the records in the Grid are refreshed.

My problem after refresh on the Grid, it returns to page 1 instead of page 7 where I left.

Thank you.


Solution

  • To just retrieve the active page (as per the docs):

    // t is reference to the paging toolbar instance
    var activePage = Math.ceil((t.cursor + t.pageSize) / t.pageSize);
    

    But if you are doing server side paging, the refresh method will already pass through the cursor to the load method

    doRefresh : function() {
        this.doLoad(this.cursor);
    }
    

    this will then populate the start parameter of the load options which you can use along with the pagesize (will be set as the 'limit' param) to return the correct page on refresh