日期:2014-05-16  浏览次数:20412 次

ExtJS 分页扩展
Ext.namespace('Ext.ux.grid')
Ext.ux.grid.PagingToolbarExp = function(config) {
var config = config || {};
this.everyPageCount = config.everyPageCount || 7;
this.everyPageSizeData = [ ['5', 5], ['10', 10], ['20', 20],
   ['50', 50], ['100', 100]];
if (config.everyPageSizeData) {
  Ext.apply(this.everyPageSizeData, config.everyPageSizeData);
}
Ext.ux.grid.PagingToolbarExp.superclass.constructor.call(this, config);
this.initAction();
}

var T = Ext.Toolbar;
Ext.extend(Ext.ux.grid.PagingToolbarExp, Ext.PagingToolbar, {
displayMsg : "显示 第 【{0}】 条到 【{1}】 条记录,一共 【{2}】 条",
emptyMsg : "没有记录",
beforePageText : '页码',
afterPageText : '总页数【{0}】',
firstText : '首页',
prevText : '上一页',
nextText : '下一页',
lastText : '末页',
refreshText : '刷新',
initAction : function() {

},
initComponent : function() {
  var pagingItems = [this.first = new T.Button({
       tooltip : this.firstText,
       overflowText : this.firstText,
       iconCls : 'x-tbar-page-first',
       disabled : true,
       handler : this.moveFirst,
       scope : this
      }), this.prev = new T.Button({
       tooltip : this.prevText,
       overflowText : this.prevText,
       iconCls : 'x-tbar-page-prev',
       disabled : true,
       handler : this.movePrevious,
       scope : this
      }), '-', this.beforePageText,
    this.inputItem = new Ext.form.NumberField({
       cls : 'x-tbar-page-number',
       allowDecimals : false,
       allowNegative : false,
       enableKeyEvents : true,
       selectOnFocus : true,
       submitValue : false,
       listeners : {
        scope : this,
        keydown : this.onPagingKeyDown,
        blur : this.onPagingBlur
       }
      }), '-',
    '每页 ', this.pageSizeCombox = new Ext.form.ComboBox({
       store : new Ext.data.SimpleStore({
          fields : ['text', 'value'],
          data : this.everyPageSizeData
         }),
       mode : 'local',
       displayField : 'text',
       valueField : 'value',
       editable : false,
       scope : this,
       allowBlank : false,
       triggerAction : 'all',
       value : this.pageSize,
       listWidth : 45,
       width : 45,
       listeners : {
        scope : this,
        select : this.gotoSelectPage

&n