我正在尝试使用 loadData 方法在 JSONStore 中加载数据,但它只在存储中加载单个记录。这是代码片段
var myRecord = Ext.data.Record.create([
{
name: 'Rid',
type: 'string',
mapping: 'id.value'
}, {
name: 'accountId',
type: 'string',
mapping: 'accountId.value'
}, {
name: 'nickName',
type: 'string'
}
]);
var myStore = new Ext.data.JsonStore({
storeId: 'storeID',
fields: myRecord,
root: 'recipientResponse',
autoLoad: false
});
myStore.loadData(jsonResponse,true);
这是我传递给 loadData 方法的示例 JSON 响应
{ recipientResponse: [
{
"id":{
"value":"58144340bedf4a328669c98b29446b6b"
},
"locked":null,
"accountId":{
"type":null,
"value":"1122334455"
},
"nickName":"Dad",
"customerId":{
"value":"partialpay7"
},
"accountType":"CHECKING",
"emailAddress":"blah@blah.com",
"person":null,
"deleted":null,
"txPasscode":"Cho"
},
{
"id":{
"value":"5fb1e201a939433faea6c39e33caef78"
},
"locked":null,
"accountId":{
"type":null,
"value":"6655223311"
},
"nickName":"Jane Doe",
"customerId":{
"value":"partialpay7"
},
"accountType":"CHECKING",
"emailAddress":"blah@blah.com",
"person":null,
"deleted":null,
"txPasscode":"Cho"
},
{
"id":{
"value":"a24b32fd180e4886b1f562d9a3b2f0ce"
},
"locked":null,
"accountId":{
"type":null,
"value":"998877665544"
},
"nickName":"Sam Jones",
"customerId":{
"value":"partialpay7"
},
"accountType":"CHECKING",
"emailAddress":"blah@blah.com",
"person":null,
"deleted":null,
"txPasscode":"Cho"
}
]}
谢谢