Ext获得grid的当前页是第几页


var d = pt.getPageData();
var pageNum = pt.readPage(d);
alert(pageNum);

pt 为绑定Ext.grid.GridPanel的bbar分页工具Ext.PagingToolbar对象

这是查看源码找到的:Ext.PagingToolbar
onPagingKeyDown : function(field, e){
        var k = e.getKey(), d = this.getPageData(), pageNum;
        if (k == e.RETURN) {
            e.stopEvent();
            pageNum = this.readPage(d);
            if(pageNum !== false){
                pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
                this.doLoad(pageNum * this.pageSize);
            }
        }else if (k == e.HOME || k == e.END){
            e.stopEvent();
            pageNum = k == e.HOME ? 1 : d.pages;
            field.setValue(pageNum);
        }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
            e.stopEvent();
            if((pageNum = this.readPage(d))){
                var increment = e.shiftKey ? 10 : 1;
                if(k == e.DOWN || k == e.PAGEDOWN){
                    increment *= -1;
                }
                pageNum += increment;
                if(pageNum >= 1 & pageNum <= d.pages){
                    field.setValue(pageNum);
                }
            }
        }
    },

因为以前很懒,所以什么也没留下,现在才发现网络的强大功能,所以将最近学习工作中发现的发布出来,帮助别人,也帮助自己,以前总觉得自己代码垃圾,所以从不保存代码,结果往往垃圾的代码,在我要用的时候没有,又只有从新来查找,所以

你可能感兴趣的:(工作,ext,UP)