Categories | Question details Back To List | ||||||||
assign the cellIndex in header by contextmenu in header Hi, i have the same problem as http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=4516&ssr=yes&s=menu%20zoneid Can you send me a sample please? Thanks in advance! pyt Answer posted by Alex (suppot) on Sep 07, 2009 05:39 Hello, the sample for 2.5 version is attached Attachments (1)
Answer posted on Sep 14, 2009 06:30 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> Thanks in advance! pyt |