2016-09-22 142 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