Hi,
i have the same problem as dhtmlx.com/docs/products/kb/ … u%20zoneid
Can you send me a sample please?
Thanks in advance!
pyt
Thanks a lot. It works in the first row of header great. I have just a problem with the second row of header. Contextmenu is horizontal offseted and by higher cellIndex is not visible.
I use following codes:
menu = new dhtmlXMenuObject(null,“dhx_blue”);
menu.setImagePath("/images/");
menu.setIconsPath("/images/");
menu.attachEvent(“onBeforeContextMenu”,header_pre_function);
menu.loadXML("…");
menu.renderAsContextMenu();
menu.attachEvent(“onClick”,onButtonClick);
mygrid = new dhtmlXGridObject(‘grid_div’);
mygrid.enableContextMenu(menu);
mygrid.setImagePath("/imgs/");
mygrid.loadXML(‘myXML’);
mygrid.attachEvent(“onBeforeContextMenu”,pre_function);
for(var i = 0; i < mygrid.hdr.rows[1].cells.length;i++){
var index = 100+i;
mygrid.hdr.rows[1].cells[i].id = “zone_”+index;
menu.addContextZone(“zone_”+index);
}
if(mygrid.hdr.rows.length = = 3){
for(var i = 0; i < mygrid.hdr.rows[2].cells.length;i++){
var index = 200+i;
mygrid.hdr.rows[2].cells[i].id = “zone_”+index;
menu.addContextZone(“zone_”+index);
}
}
…
function header_pre_function(zone_id){
var index = zone_id.split("_")[1];
var cellInd = index%100;
var rowInd = parseInt((index/100))-1;
if(cellInd != 0){
var cellVal = mygrid.getColumnLabel(cellInd,rowInd);
ctmn_pre(cellVal); // another function
return true;
}
else
return false;
}
and my xml file:
<head>
<column … >A</column>
<column … >#cspan</column>
<column … >B</column>
<column … >#cspan</column>
<column … >C</column>
<column … >#cspan</column>
…
<afterInit>
<call command=“attachHeader”><param>a1,a2,b1,b2,c1,c2,…</param></call>
…
</afterInit>
</head>
Thanks in advance!
pyt