2016-09-22 102 views
0

使用ExtJS框架创建组合框。但分页不起作用。你能帮忙吗?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条记录显示在每个页面。 enter image description here

如图所示每页显示全部24条记录。期望是每页有1条记录。

回答

3

组合框总是显示商店中的所有数据。通常,当您使用分页时,商店不保存来自服务器的所有数据。代理从而管理数据。

请检查您是否使用MemoryProxy与enablePaging和数据会发生什么:

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'] 
     ] 
    } 
}); 
+0

其工作非常感谢 – Maddy