我有一个这样的 JSON
{
"success": true,
"users": [{
"name":"Boom",
"emails": [{
"first": "syedwaseem@yahoo.com",
"second": "ed@sencha.com",
"countries":[{
"label":"pakistan",
"continent":"asia"
}]
}]
}]
}
我已经为它创建了这样的模型
Ext.define('WR.model.WorkRecord', {
extend: 'Ext.data.Model',
fields: ['name'],
hasMany: {model: 'WR.model.Email', name: 'emails'}
});
Ext.define('WR.model.Email', {
extend: 'Ext.data.Model',
fields: ['first', 'second'],
belongsTo: {model : 'WR.model.WorkRecord', name: 'users'},
hasMany: {model: 'WR.model.Countries', name: 'countries'}
});
Ext.define('WR.model.Countries', {
extend: 'Ext.data.Model',
fields: ['label', 'continent'],
belongsTo: {model: 'WR.model.Email', name: 'emails'}
});
现在我想填充具有 id 的表单formJobSummary
。我通过在存储中调用此函数成功地为非嵌套 JSON
listeners: {
load: function(users) {
var form = Ext.getCmp('formJobSummary');
form.loadRecord(this.data.first());
}
}
我的表单只有简单的显示字段,我想通过这个嵌套的 JSON 填充它们谢谢