Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Andreas Mischinski on Nov 03, 2008 22:44
open dhtmlx forum
Handling events with multiple grids

Hi,

I`m inititializing number of grdis in one page from xml with this code :

for (var i = 0; i < g_xmlDataTablesString.length; i++) {

rawGridArray[i] = new dhtmlXGridObject("" + g_xmlDataTablesString[i] + "");

rawGridArray[i].attachEvent("onEditCell", doOnCellEdit);
rawGridArray[i].setImagePath("codebase/imgs/");
rawGridArray[i].init();
rawGridArray[i].loadXML("" + "../" + g_xmlDataTablesString[i] + ".xml" + "");
rawGridArray[i].setSkin("light")
rawGridArray[i].enableLightMouseNavigation(true);

}

g_xmlDataTablesString contains here the div ids for my dynamically created page.

After one cell is edited, I want to do some custom calculation(calculate quartils, median, average value of each column ).

How can I get a reference to the grid, which just fired the onEditCell Event ?

Thanks,

Andreas
Answer posted by Support on Nov 04, 2008 02:12
Inside each event "this" points to the grid instance
function doOnCellEdit(a,b,c,d,e){
     //this == grid instance
}

>>After one cell is edited, I want to do some custom calculation(calculate quartils, median, average value of each column ).
Grid already have some support for such functionality
    http://dhtmlx.com/docs/products/docsExplorer/index.shtml?type=smpl