Hi everyone!
I have a question, if i have main model like this:
Code:
Ext.define('Associations.model.Document', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.Integer'
],
uses: [
'Associations.model.IncludedModel'
],
fields: [
{
type: 'int',
name: 'Field1'
},
{
type: 'int',
name: 'Field2'
}
],
hasOne: {
associatedName: 'includedModel',
model: 'Associations.model.IncludedModel',
name: 'includedModel'
}
});
and included model:
Code:
Ext.define('Associations.model.IncludedModel', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.String'
],
fields: [
{
type: 'string',
name: 'Test1'
},
{
type: 'string',
name: 'Test2'
}
]
});
If i use:
Code:
Ext.create('Associations.model.Document').getData();
It will return just fields from Document like:
Code:
{Field1: null; Field2: null}
But i need this:
Code:
{Field1: null; Field2: null, includedModel: {Field1: ""; Field2: ""}}
How can i get a full stuctured JSON with all fields?