簡體   English   中英

帶有組合框的ExtJS分頁

[英]ExtJS Paging with Combo box

用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條記錄。 在此處輸入圖片說明

如圖所示,每頁顯示所有24條記錄。 期望每頁有1條記錄。

組合框始終顯示存儲中的所有數據。 通常,使用分頁時,存儲不會保存服務器中的所有數據。 代理因此管理數據。

如果將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']
        ]
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM