1

这是我的网格 JsonStore。

var itemListStore = new Ext.data.JsonStore({
    id : 'itemListStore',
    proxy : new Ext.data.HttpProxy({
        url : 'test.php',
    }),
    totalCnt : 'totalCnt', // ?
    lastUpdate : 'lastUpdate', // ?
    root : 'content', // it works ok
    fields : [
        {name : 'name', type : 'string'},
        {name : 'id', type : 'string'},
    ],
    autoLoad: true,
    listeners : {
        load : function(){
            // I need to get the totalCnt and lastUpdate field value
            alert(this.lastUpdate); // output : lastUpdate -,.-
        }
    }
});

代理数据是这样的

{"totalCnt":95,"lastUpdate":"2011-08-01 09:20:03.000","content":[{"name":"MURRAY MP220GF...... ......

我可以使用 content(root) 绘制网格,但无法在加载函数中获取 totalCnt 和 lastUpdate 字段。

有人知道这个,请帮助我

谢谢。

4

2 回答 2

2

它应该是totalProperty而不是 totalCnt

var store = new Ext.data.JsonStore({
   ...config...
   totalProperty: 'totalCnt'
});
于 2011-08-01T17:38:52.963 回答
2

您可以通过以下方式获得它:

itemListStore.proxy.getReader().rawData.totalCnt

更新:
替换readergetReader()
查看文档

于 2011-08-01T18:05:23.143 回答