You want to create two models:
- Father
- Child
In your Father model add a HasMany association with child. I.E. Father has many child.
Code:
hasMany:{model:'Child', name:'chidren'}
[Optional: In your Child add a BelongsTo association with Father.]
This will assume your JSON data for the father call looks something like:
Code:
[{
name: 'Fred',
spouse: 'Wilma',
children: [{
name: 'Pebbles'
}]
}]
When you click on a Father in the Fathers grid you will do a bind store on the Childrens grid using record.children (). For Example:
Code:
onItemClick: function (grid, record, item) {
this.childrenGrid.bindStore (record.children ());
}
When you add or edit a child, do it in the "children ()" store of the father record. Saving the father record or synching the father store will then send your changes back to the server.