Saving subgrid

Hi,



Need some advice on saving subgrids. If I wanted to save main grid and subgrids with a single “Save” button, would I need to do something like below where each subgrid gets its own dataprocessor?





oDPMain.sendData(); //data processor for main grid



for (var iRow; iRow<oMainGrid.getRowsNum(); iRow++)

{

oSubGrid = oMainGrid.cells2(iRow, 1).getSubGrid();



//data processor for sub grids

oDPSub = new dataProcessor(“dataprocessor.php”);

oDPSub .setUpdateMode(“off”)

oDPSub .setTransactionMode(“POST”, true);

oDPSub .enableDataNames(true);

oDPSub .init(oSubGrid);



oDPSub .sendData();



}







Yes you have to attach dhtmlxDataProcessor to the evety sub grid object as
You can try to use dhtmlxTreeGrid extention wich has more extended parent-child functionality. In such case you should attach dhtmlxDataProcessor to the whole treeGrid only. Please see more information here dhtmlx.com/docs/products/dhtmlxT … ndex.shtml


I found this link that shows how to assign dataprocessor to subgrid.  How do I get a handle on each dataprocessor when I want to send the data for each subgrid?  I think the way I stated above seems wrong.



dhtmlx.com/docs/products/kb/inde … %20subgrid

You can store sub grid’s data processor references in the some global collection or like a sub grid property. At the necessary moment you can call dp[i].sendData() method to the every of data processors.