加载下一页网格Ext JS 4

时间:2012-05-31 14:28:46

标签: json extjs grid extjs4

我正在尝试为网格中的每个页面加载15条记录:pageSize : 15,,服务器正在向我发送15页,问题是网格中的下一页按钮被禁用。

商店:

Ext.define('UserStore', {    
extend: 'Ext.data.Store',
model: 'UserModel',
autoLoad : true,
pageSize : 15,
remoteSort: true,
proxy: {
    type: 'ajax',
    url: 'url/to/servlet',
    reader: {
        type: 'json',
        root: 'data',
        totalProperty: 'total'
    },
    writer: {
        type : 'json',
        root: 'data'    
    },
    actionMethods: {
        read   : 'POST',
        create : 'POST',
        update : 'POST',
        destroy: 'POST'
    },
    extraParams : {
        data : 'Blank',
    }

},
sortOnLoad: true,
sorters: { property: 'dateTime', direction : 'DESC' },

});

网格:

xtype : 'gridpanel',
store : mystore,
height : 350,
columns : [ {
          dataIndex : 'firstName',
          text      : 'First Name',
          flex      : 1
        },{
          dataIndex : 'lastName',
          text      : 'Last Name',
          flex      : 1
        },{
          dataIndex : 'email',
          text      : 'Email',
          flex      : 1  
 }],
 dockedItems : [ {
    xtype : 'pagingtoolbar',
    hight : 28,
    displayInfo : true,
    dock : 'bottom'
} ]

加载网格:我测试了3种方法:

  • grid.getStore().loadPage(1);
  • grid.getStore().load({ params:{start : 0, limit : 15}});
  • grid.getStore().load();

修改 enter image description here

1 个答案:

答案 0 :(得分:0)

主要是因为您从服务器收到的数据中缺少totalCount属性。 通过这种方式,网格将计算分页工具栏。

相关问题