使用ExtJS框架创建了一个组合框。但是分页不起作用。你能帮忙吗?
var store = new Ext.data.ArrayStore({
fields: ['id'],
pageSize:1,
data : [
['15'], ['25'], ['225'], ['325'], ['525'], ['625'], ['125'], ['8725'], ['825'], ['1825'], ['3825'], ['4825'], ['67825'], ['82725'], ['84725'], ['86725'], ['87525'], ['87625'], ['872665'], ['235'], ['235'], ['225'], ['245'], ['550']
]
});
var combo = new Ext.form.ComboBox({
name : 'perpage',
width: 40,
mode : 'remote',
value: '1',
store: store, //the store you use in your grid
pageSize:true,
listWidth : 1,
width : 600,
triggerAction : 'all',
displayField : 'id',
valueField : 'id',
forceSelection: true
});
var window = Ext.create('Ext.window.Window', {
width: 650,
height: 100,
items: [combo]
}).show();
如图所示,每页显示所有24条记录。期望是每页有1条记录。
答案 0 :(得分:3)
组合框始终显示商店中的所有数据。通常,使用分页时,存储不会保留服务器中的所有数据。因此代理管理数据。
如果您使用带有enablePaging和data的MemoryProxy,请检查会发生什么:
var store = new Ext.data.ArrayStore({
fields: ['id'],
pageSize:1,
proxy: {
type:'memory'
enablePaging:true,
data : [
['15'], ['25'], ['225'], ['325'], ['525'], ['625'], ['125'], ['8725'], ['825'], ['1825'], ['3825'], ['4825'], ['67825'], ['82725'], ['84725'], ['86725'], ['87525'], ['87625'], ['872665'], ['235'], ['235'], ['225'], ['245'], ['550']
]
}
});