Results 1 to 7 of 7

Thread: PagingToolBar: extension - add public method - goToPage()

  1. #1
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    87
      0  

    Default PagingToolBar: extension - add public method - goToPage()

    I didn't know what to call it, so i called it 'CustomToolBar'. i looked at the source, didn't see anything like it.

    PHP Code:
    // Create user extensions namespace (Ext.ux)
    Ext.namespace('Ext.ux');

    Ext.ux.CustomToolBar = function(config) {
        
    // call parent constructor
        
    Ext.ux.CustomToolBar.superclass.constructor.call(thisconfig);
     

     
    // extend
    Ext.extend(Ext.ux.CustomToolBarExt.PagingToolbar, {
        
    goToPage : function (pageNum) {
            var 
    this.getPageData();
            
    pageNum Math.min(Math.max(1pageNum), d.pages) - 1;
            
    this.doLoad(pageNum this.pageSize);
        }
    }); 
    // end of extend 
    usage:
    PHP Code:
    var paging = new Ext.ux.CustomToolBar ({your config data});
    // Jump to page
    paging.goToPage(int); 

  2. #2
    Sencha User JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
      0  

    Default

    If the only reason you're extending the PagingToolbar is to add a new method to it, why not just use an override?

    Code:
    Ext.PagingToolbar.override({
        goToPage : function (pageNum) {
            var d = this.getPageData();
            pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
            this.doLoad(pageNum * this.pageSize);
         }
    });
    Jeff Howden
    Ext JS - Support Team Volunteer
    jeff@extjs.com

  3. #3
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    87
      0  

    Default

    ack, you're right! meh! i forgot about .override

    Thanks jeff.

  4. #4
    Sencha User JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
      0  

    Default

    Always happy to help (especially those with a much higher post count than mine ).
    Jeff Howden
    Ext JS - Support Team Volunteer
    jeff@extjs.com

  5. #5
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    87
      0  

    Default

    Why are folks worried about post count around here?

  6. #6
    Sencha User JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
      0  

    Default

    No reason. I only brought it up cause I saw someone give you grief about it a few days ago.
    Jeff Howden
    Ext JS - Support Team Volunteer
    jeff@extjs.com

  7. #7

Posting Permissions

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