Extjs 设置ComboBox下拉选择分页
我在extjs中的gridpanel中的PagingToolbar分页中新添加了combobox下拉选择分页的功能预览图如下:
其中的部分代码如下:
Ext.define("Model", {
extend: "Ext.data.Model",
fields: [
{ name: "ID", type: "int" },
{ name: "NAME", type: "string" }
]
});
var Store = Ext.create("Ext.data.Store", {
model: "Model",
pageSize: 5,
storeId: "Store",
proxy: {
type: "ajax",
url: "Group",
reader: {
root: 'Root',
totalProperty: 'TotalProperty'
}
}
});
var combo = new Ext.form.ComboBox({
name: 'pagesize',
hiddenName: 'pagesize',
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
mode: 'local',
store: new Ext.data.ArrayStore({
fields: ['text', 'value'],
data: [['5', 5], ['10', 10],['15', 15], ['20', 20]]
}),
valueField: 'value',
displayField: 'text',
emptyText:'5',
editable: false,
width: 50
});
combo.on("select", function (comboBox) {
bbar.pageSize = parseInt(comboBox.getValue());
Store.load({ params: { start: 0, limit: bbar.pageSize} });
});
var bbar = new Ext.PagingToolbar({
pageSize: 5,
store:Store,
displayInfo: true,
displayMsg: '显示{0}条到{1}条,共{2}条',
emptyMsg: "没有记录",
items: ['-', ' 每页显示',combo,'条']
});
var GridPanel = new Ext.grid.GridPanel({
store:Store,
。。。。。。。。。。。,
bbar:bbar
});
Store.load({ params: { start: 0, limit: 5} });
Ext.onReady(function () {
var viewport = new Ext.Viewport({
layout:'fit',
items: [GridPanel]
});
});
为什么我下拉选择了条数,显示的条数依然不变?(基于Extjs4)
求答案!
[解决办法]
自己检查动态页改了 没有,动态页呀获取条数(limit),然后输出对应的数据量,