+ -
当前位置:首页 → 问答吧 → EXT gridpanel添加输入框输入显示的记录条数

EXT gridpanel添加输入框输入显示的记录条数

时间:2011-05-18

来源:互联网

这是我网上下载的不全 希望用过的帮忙给一个参考 谢谢

先定义个显示条数的下拉框
var combo = new Ext.form.ComboBox({
  name : 'perpage',
  width: 40,
  store: new Ext.data.ArrayStore({
  fields: ['id'],
  data : [ ['15'], ['25'],['50'] ]
  }),
  mode : 'local',
  value: '15',
  listWidth : 40,
  triggerAction : 'all',
  displayField : 'id',
  valueField : 'id',
  editable : false,
  forceSelection: true
  });
   
  combo.on({
  scope: this,
  select: this.onPageSizeComboSelect
  });
分页的pagingBar
 this.pagingBar = new Ext.PagingToolbar({
  pageSize: this.pageSize,
  store: this.store,
  displayInfo: true,
  displayMsg: 'Displaying records {0} - {1} of {2}',
  emptyMsg: "No records to display",
  items: [
  '-',
  'Per Page',combo]
  });
最后在你的grid里直接调用
bbar:this.pagingBar

作者: Java7z   发布时间: 2011-05-18

JScript code
当你选中多少页时
combo.on("select", function(comboBox) {
    bbar.pageSize = parseInt(combo.getValue());
    store.reload({
        params: {
            start: 0,
            limit: bbar.pageSize
        }
    });
});

作者: zoujp_xyz   发布时间: 2011-05-18