我的问题是除了totalRecords之外如何获取元数据,在我的例子中它是版本,代码,searchquery(请查看json).
{
"result": {
"version":"1",
"code":"200",
"searchquery": "false",
"totalRecords": "2",
"account":[
{
"lastname": "Ivanoff",
"firstname": "Ivan",
"accountId":"1"
},
{
"lastname": "Smirnoff",
"firstname": "Ivan",
"accountId":"2"
}
]
}
}
这是我的模型:
Ext.define("test.Account", {
extend: "Ext.data.Model",
fields: [
{name: 'accountId', type: 'string'},
{name: 'lastname', type: 'string'},
{name: 'firstname', type: 'string'}
]
});
并存储:
Ext.define("test.TestStore", {
extend: "Ext.data.Store",
model: "test.Account",
proxy: {
type: "ajax",
url: "users.json",
reader: {
type : 'json',
root : 'result.account',
totalProperty: "result.totalRecords"
}
},
listeners: {
load: function(store, records, success) {
console.log("Load: success " + success);
}
}
});
使用此商店,我可以加载记录(帐户),但无法找到任何方法来访问其余字段.
先感谢您.