For example I have 2 models:
Ext.define('Order', {
extend : 'Ext.data.Model',
fields : [
{name : 'id', type : 'int'},
{name : 'customer_id', type : 'int'},
{name : 'date', type : 'date'}
],
hasMany: [{model: 'Product', name: 'Products'}]
});
Ext.define('Product', {
extend : 'Ext.data.Model',
fields : [
{name : 'id', type : 'int'},
{name : 'name', type : 'string'},
{name : 'description', type : 'string'},
{name : 'price', type : 'float'}
],
belongsTo: 'Order'
});
these models displayed in 2 grids. Then when changes made I need post them to server. But the trick in I need post both model in one request, e.g.:
{"order":{"id":1, "date":'2011.09.01', "Products": [{"id":1, "name":"product name", ... }]}}
In this way I think both grids should use one Store and before write store in must be filled with grid changes ( maybe some internal stores without ability to write to server ).
How to implement it ? Any ideas ?