下面是Ext.grid.GridPanel分页工具条:
bbar: this.pagingToolbar=new Ext.PagingToolbar({
pageSize: 14,
store: store,
displayInfo: true,
beforePageText : "第",
afterPageText : "页共 {0} 页",
displayMsg : "显示 {0} - {1},共 {2} 条",
emptyMsg : '没有数据需要显示',
items:[
' 每页显示数',
new Ext.form.ComboBox({
store:new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : [[10,10],[15,15],[20,20],[30,30],[40,40],[60,60],[80,80],[100,100]]
}),
width:50,
displayField:'state',
typeAhead: true,
mode: 'local',
value:14,
triggerAction: 'all',
selectOnFocus:true,
listeners:{
change:{
fn:function(box,newValue,oldValue){
Page.changePageSize(newValue);
}
},
select:{
fn:function(combo, value){
Page.changePageSize(combo.getValue());
}
}
}
})
]
})
......
changePageSize:function(pageSize){
if(pageSize!=null&&pageSize>0)
this.pagingToolbar.pageSize=parseInt(pageSize);
this.store.load({params:{start:0, limit:this.pagingToolbar.pageSize}});
this.store.reload();
},
bbar: this.pagingToolbar=new Ext.PagingToolbar({
pageSize: 14,
store: store,
displayInfo: true,
beforePageText : "第",
afterPageText : "页共 {0} 页",
displayMsg : "显示 {0} - {1},共 {2} 条",
emptyMsg : '没有数据需要显示',
items:[
' 每页显示数',
new Ext.form.ComboBox({
store:new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : [[10,10],[15,15],[20,20],[30,30],[40,40],[60,60],[80,80],[100,100]]
}),
width:50,
displayField:'state',
typeAhead: true,
mode: 'local',
value:14,
triggerAction: 'all',
selectOnFocus:true,
listeners:{
change:{
fn:function(box,newValue,oldValue){
Page.changePageSize(newValue);
}
},
select:{
fn:function(combo, value){
Page.changePageSize(combo.getValue());
}
}
}
})
]
})
......
changePageSize:function(pageSize){
if(pageSize!=null&&pageSize>0)
this.pagingToolbar.pageSize=parseInt(pageSize);
this.store.load({params:{start:0, limit:this.pagingToolbar.pageSize}});
this.store.reload();
},