I have a JSON like this
{
"success": true,
"users": [{
"name":"Boom",
"emails": [{
"first": "syedwaseem@yahoo.com",
"second": "ed@sencha.com",
"countries":[{
"label":"pakistan",
"continent":"asia"
}]
}]
}]
}
I have created my models for it like this
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'}
});
Now I want to populate my form having id formJobSummary .I did it successfuly for Non-Nested JSON by calling this function in store
listeners: {
load: function(users) {
var form = Ext.getCmp('formJobSummary');
form.loadRecord(this.data.first());
}
}
My form has just simple displayfields and I want to populate them through this nested JSON
thanks
Currently you can’t use name=’property.subProperty’ in a form field definition :(.
So in order to make this work, I revert the logic – add (a redundant) field definition to model:
then you can create a form field like:
And it will be populated on form.loadRecord()