Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Michael on Jun 22, 2009 14:01
open dhtmlx forum
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();

}



Answer posted by dhxSupport on Jun 23, 2009 04:27
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 http://dhtmlx.com/docs/products/dhtmlxTreeGrid/index.shtml
Answer posted on Jun 23, 2009 06:46

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.

http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=2638&ssr=yes&s=dataprocessor%20subgrid

Answer posted by dhxSupport on Jun 23, 2009 07:19
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.