1. #1
    Ext User
    Join Date
    Apr 2007
    Location
    Melbourne, Australia
    Posts
    169
    Vote Rating
    0
    Zakaroonikov is on a distinguished road

      0  

    Default [2.0??][FIXED] PagingToolbar and Page '0'

    [2.0??][FIXED] PagingToolbar and Page '0'


    I have noticed (also on the example) that when you enter page 0 in the paging toolbar nothing happens. When you enter -1 it reverts to 1. Should this not be the same for 0?

    The function readPage returns false if the value is not valid (ie alpha instead of numeric). It returns the integer value of the field so if you enter '0' it returns 0 which produces the same result as if the routine returns false.

    To fix this I have checked to see if the value is either not boolean or true instead of just true:

    old code:
    PHP Code:
        // private
        
    onPagingKeydown : function(e){
            var 
    e.getKey(), this.getPageData(), pageNum;
            if (
    == e.RETURN) {
                
    e.stopEvent();
                           if(
    pageNum this.readPage(d)){
                    
    pageNum Math.min(Math.max(1pageNum), d.pages) - 1;
                    
    this.doLoad(pageNum this.pageSize);
                }
            }else if (
    == e.HOME || == e.END){
                
    e.stopEvent();
                
    pageNum == e.HOME d.pages;
                
    this.field.dom.value pageNum;
            }else if (
    == e.UP || == e.PAGEUP || == e.DOWN || == e.PAGEDOWN){
                
    e.stopEvent();
                if(
    pageNum this.readPage(d)){
                    var 
    increment e.shiftKey 10 1;
                    if(
    == e.DOWN || == e.PAGEDOWN){
                        
    increment *= -1;
                    }
                    
    pageNum += increment;
                    if(
    pageNum >= pageNum <= d.pages){
                        
    this.field.dom.value pageNum;
                    }
                }
            }
        }, 
    New Code:
    PHP Code:
        // private
        
    onPagingKeydown : function(e){
            var 
    e.getKey(), this.getPageData(), pageNum;
            if (
    == e.RETURN) {
                
    e.stopEvent();
                
    pageNum this.readPage(d);
            if(
    typeof pageNum != 'boolean' || pageNum){
                    
    pageNum Math.min(Math.max(1pageNum), d.pages) - 1;
                    
    this.doLoad(pageNum this.pageSize);
                }
            }else if (
    == e.HOME || == e.END){
                
    e.stopEvent();
                
    pageNum == e.HOME d.pages;
                
    this.field.dom.value pageNum;
            }else if (
    == e.UP || == e.PAGEUP || == e.DOWN || == e.PAGEDOWN){
                
    e.stopEvent();
                
    pageNum this.readPage(d);
            if(
    typeof pageNum != 'boolean' || pageNum){
                    var 
    increment e.shiftKey 10 1;
                    if(
    == e.DOWN || == e.PAGEDOWN){
                        
    increment *= -1;
                    }
                    
    pageNum += increment;
                    if(
    pageNum >= pageNum <= d.pages){
                        
    this.field.dom.value pageNum;
                    }
                }
            }
        }, 

  2. #2
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Thanks, we'll take a look.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Fixed in SVN.

Thread Participants: 1