Results 1 to 10 of 10

Thread: How can I get pagingtoolbar current page number?

  1. #1

    Default How can I get pagingtoolbar current page number?

    How can I get pagingtoolbar current page number?How can I get pagingtoolbar's input field's value?Thks.
    I want to get pagingtoolbar pageSize,I use alert(bbar.pageSize),but error message is pageSize is undefined.
    I use alert(bbar.getPageData().activePage),but error message is getPageData() is not a function.
    So.....I need help.

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    http://extjs.com/deploy/dev/docs/?cl...tBottomToolbar

    The bbar property is the Ext.Element into which the Ext.PagingToolbar was rendered.

  3. #3

    Default

    Hmm, to be honest I still don't know how to get this problem solved.
    Can anybody maybe give a more clear example?

    I'm very new to ExtJS, and I don't really find the answer in the documentation.
    Thanks in advance!

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

  5. #5

    Default

    for you this is obvious, for other people who aren't that used to work with ExtJS this is like Chinese. Just giving a link doens't is really saying "dude.. I don't care.. get a book".

    Thanks, but no thanks... I'll ask somebody who's really willing to help.

  6. #6

    Default A possible solution

    PHP Code:
    /*
     * This is something I put in a seperate .js file, where I have some other grid things 
     * in aswell. It's included in every grid page so that I don't need to write the same code 
     * over and over again.
     *
     * A listener is added to trigger the function every time the user goes to an other page, 
     * that way the params are always up-to-date
     */

    MyPagingToolbar Ext.extend(Ext.PagingToolbar, {
        
    pageSize25,
        
    displayInfotrue,
        
    listeners: {change : function(thisdparams)
                            {            
                                 
    /* params.activePage
                                  * params.pages
                                  * params.total
                                  */
                                 
    pages params.pages;
                                 
    total params.total;
                                 
    activePage params.activePage;
                             }
                     }
    });

    /*
     * In your HTML file, where you create your grid you can just call the variable whenever 
     * you like.
     */

    // create the Grid
    var grid = new MyGrid({
      
    storejstore,
      
    cmcm,
      
    renderTo:'grid-extjs',
      
    bbar: new MyPagingToolbar({
            
    storejstore
      
    })
    });

    //for people who like to test with Firebug
    console.log(activePage); 

  7. #7
    Sencha Premium Member milestonebass's Avatar
    Join Date
    Dec 2009
    Location
    Melbourne, Australia
    Posts
    28

    Default

    Animal's two posts are all the information you need.

    1. call getBottomToolbar() on the Element containing the paging toolbar
    2. Math.ceil((t.cursor + t.pageSize) / t.pageSize); - where t is the toolbar as described in Step 1.

    The URL links are saying "dude... here's the solution!"

  8. #8
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    1

    Default

    Quote Originally Posted by imp4ct View Post
    PHP Code:
    /*
     * This is something I put in a seperate .js file, where I have some other grid things 
     * in aswell. It's included in every grid page so that I don't need to write the same code 
     * over and over again.
     *
     * A listener is added to trigger the function every time the user goes to an other page, 
     * that way the params are always up-to-date
     */

    MyPagingToolbar Ext.extend(Ext.PagingToolbar, {
        
    pageSize25,
        
    displayInfotrue,
        
    listeners: {change : function(thisdparams)
                            {            
                                 
    /* params.activePage
                                  * params.pages
                                  * params.total
                                  */
                                 
    pages params.pages;
                                 
    total params.total;
                                 
    activePage params.activePage;
                             }
                     }
    });

    /*
     * In your HTML file, where you create your grid you can just call the variable whenever 
     * you like.
     */

    // create the Grid
    var grid = new MyGrid({
      
    storejstore,
      
    cmcm,
      
    renderTo:'grid-extjs',
      
    bbar: new MyPagingToolbar({
            
    storejstore
      
    })
    });

    //for people who like to test with Firebug
    console.log(activePage); 
    this is working, only the params should be:
    /* params.currentPage
    * params.pageCount
    * params.total
    */

  9. #9
    Sencha User
    Join Date
    Jan 2011
    Posts
    26

    Default

    you are sucking up to animal - it won't work

  10. #10
    Sencha Premium Member milestonebass's Avatar
    Join Date
    Dec 2009
    Location
    Melbourne, Australia
    Posts
    28

    Default

    ... I hope you aren't speaking from experience!

Posting Permissions

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