PDA

View Full Version : Mapping a model containing two associations to a form with fields and grids



Martin.S
11 Mar 2014, 1:22 PM
Hi

What is the best approach to map a model containing two associations to a form with fields and grids?
Here is what my model looks like:

UniqueRecordModel {
ParentFields: { //hasOne association on the model
Field1: value,
Field2: value,
Field3: value
},
ChildTables: { // hasOne association on the model. Note: multiple child tables exist: ChildTable1, ChildTable2, etc.
ChildTable1: [ //hasMany association on the ChildTable model
{
Field1: value,
Field2: value
},
{
Field1: value,
Field2: value
},
{
Field1: value,
Field2: value
},
],
ChildTable2: [ //hasMany association on the ChildTable model
{
Field1: value,
Field2: value
},
{
Field1: value,
Field2: value
},
{
Field1: value,
Field2: value
},
],
}
}



The form is like this:



FormView: {
xtype: 'form',
layout: 'vbox',
items: [
{
xtype: container,
items: [
{
name: Field1
},
{
name: Field2
},
{
name: Field2
},
]
},
{
xtype: grid,
ame: childTable1
},
{
xtype: grid,
name: childTable2
}
]
}



If we were to perform a FormView.loadRecord(UniqueRecord), how can we make this map correctly?

Thanks for any thoughts on this.