View Full Version : Bind data in two Grid. How?

25 Nov 2010, 6:10 AM
On my page i have two grids: MainGrid and SubMainGrid. when the page is opened - automaticly load data to MainGrid.
when the user click on row MainGrid - start load relavant (assotiate) data to SubMainGrid (I use method setBaseParam

'rowclick' : function(oGrid, nIndex, eEvent){
SubMainGrid.getStore().setBaseParam('id', nIndex);

all ok.

But now, i nead realize function added new records in subMainGrid, which relevant(assotiate) with the data in selected row in MainGrid/ So, how can i do it?
How i can bind this data?
Have any idea?

25 Nov 2010, 6:23 AM
And your id is the row index? That looks like a very bad design!

All this data is coming from the server, so you need to send a request to the server when you add records so it's database can be updated.

25 Nov 2010, 6:29 AM
And your id is the row index? That looks like a very bad design!

Condor, why is it a bad design? How would you do?

25 Nov 2010, 6:39 AM
'rowclick': function(oGrid, nIndex, eEvent){
var record = oGrid.getStore().getAt(nIndex);
SubMainGrid.getStore().setBaseParam('id', record.get('someField'));

25 Nov 2010, 6:44 AM
ohhhhh, you about it:)

Thanks, Condor, you're cool!