Categories | Question details Back To List | ||
ev.srvElement has no properties -- Contextmenu &grid I'm using dhtmlxWindow with grid in it. And now I'm trying to have context menu showing for the grid to delete row. But every time when I right click on the grid it gives this error message: ev.srcElement has no properties. ...../dhtmxGrid/codebase/dhtmlxgrid.js Line: 107 Can you help me on this? Thanks. The script is as below. <!-- dhtmlxMenu --> <link rel="stylesheet" type="text/css" href="<?php echo $dhtml_path;?>dhtmlxMenu/codebase/skins/dhtmlxmenu_dhx_skyblue.css"> <script src="<?php echo $dhtml_path;?>dhtmlxMenu/codebase/dhtmlxcommon.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxMenu/codebase/dhtmlxmenu.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxMenu/codebase/ext/dhtmlxmenu_ext.js"></script> <!-- dhtmlxWindows --> <link rel="stylesheet" type="text/css" href="<?php echo $dhtml_path;?>dhtmlxWindows/codebase/dhtmlxwindows.css"> <link rel="stylesheet" type="text/css" href="<?php echo $dhtml_path;?>dhtmlxWindows/codebase/skins/dhtmlxwindows_dhx_skyblue.css"> <script src="<?php echo $dhtml_path;?>dhtmlxWindows/codebase/dhtmlxcommon.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxWindows/codebase/dhtmlxwindows.js"></script> <!-- dhtmlxGrid --> <script src="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/dhtmlxcommon.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/dhtmlxgrid.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script> <link rel="stylesheet" type="text/css" href="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/dhtmlxgrid.css"> <link rel="stylesheet" type="text/css" href="<?php echo $dhtml_path;?>dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css"> <!-- dhtmlxAjax --> <script src="<?php echo $dhtml_path;?>dhtmlxAjax/codebase/dhtmlxcommon.js"></script> <script src="<?php echo $dhtml_path;?>dhtmlxWindows/codebase/dhtmlxcontainer.js"></script> <script> var dhxWins, menu1, menu2, gridsArray = new Array(); var startX = 20 var startY = 20; function doOnLoad() { // web mode; menu1 = new dhtmlXMenuObject("menuWeb"); menu1.setIconsPath("<?php echo $dhtml_path;?>dhtmlxMenu/samples/common/imgs/"); menu1.setOpenMode("web"); //menu1.loadXML("<?php echo $dhtml_path;?>dhtmlxMenu/samples/common/dhxmenu.xml"); menu1.setIconsPath("pics/"); menu1.setOverflowHeight(5); menu1.setTopText("<font color=#999999><i>Faculty of Engineering</i></font>"); parentId = "system"; menu1.addNewSibling(null, "system", "System", false); menu1.addNewChild(parentId, 0, parentId+"_"+"logout", "Logout", false, "close.gif"); parentId = "stuInfo"; menu1.addNewSibling("system", parentId, "Student Information", false); var opts = <?php $sub_menu_array = array(); $app_years = get_distinct_application_year($db); foreach ($app_years as $ay) { $sub_menu_array[] = "Array('$ay', 'Application Year $ay', 'open.gif')"; } echo "Array(".implode(",", $sub_menu_array).")"; ?>; for (i=0; i<opts.length; i++) { menu1.addNewChild(parentId, i, parentId+"_"+opts[i][0], opts[i][1], false, opts[i][2]); } parentId = "sysSettings"; menu1.addNewSibling("stuInfo", parentId, "System Settings", false); var opts = Array(Array('appYear', 'Current Application Year', 'settings.gif'), Array('deadline', 'Deadline for PSF', 'settings.gif')); for (i=0; i<opts.length; i++) { menu1.addNewChild(parentId, i, parentId+"_"+opts[i][0], opts[i][1], false, opts[i][2]); } parentId = "reports"; menu1.addNewSibling("sysSettings", "reports", "Reports", false); var opts = Array(Array('id1', 'Report 1', 'report.gif'), Array('id2', 'Report 2', 'report.gif')); for (i=0; i<opts.length; i++) { menu1.addNewChild(parentId, i, parentId+"_"+opts[i][0], opts[i][1], false, opts[i][2]); } parentId = "help"; menu1.addNewSibling("reports", "help", "Help", false); menu1.addNewChild(parentId, 0, parentId+"_"+"about", "About ... ", false, "about.gif"); menu1.attachEvent("onClick", menuOnClick); menu2 = new dhtmlXMenuObject(); menu2.setIconsPath("pics/"); menu2.renderAsContextMenu(); //menu2.addNewSibling(null, "delete", "Delete", false); menu2.addNewChild(menu2.topId,0,"delete_row","Delete", false); //menu2.loadXML("<?php echo $dhtml_path;?>/dhtmlxGrid/samples/common/_context.xml"); menu2.attachEvent("onClick",function(menuitemId, type){ alert("here"); }); // windows dhxWins = new dhtmlXWindows(); dhxWins.enableAutoViewport(false); dhxWins.attachViewportTo("winVP"); dhxWins.setImagePath("pics/"); } function menuOnClick(id){ if (id.substring(0, 7) == "stuInfo") { syear = id.substring(8, 12); id = "stuInfo"; } switch (id) { case "stuInfo": winID = "stuInfo_" + syear + "_window"; if (dhxWins.window(winID)) { dhxWins.window(winID).bringToTop(); } else { dhxWins.createWindow(winID, startX, startY, 810, 650); startX = startX + 20; startY = startY + 20; if (startX > 230) { startX = 20; } if (startY > 140) { startY = 20; } dhxWins.window(winID).setText("Student Information - Application Year " + syear); dhxWins.window(winID).button("stick").show(); dhxWins.window(winID).setIcon("open.gif", "open.gif"); gridsArray[winID] = dhxWins.window(winID).attachGrid(); gridsArray[winID].setHeader("ID, Last Name, First Name, Gender, Session GPA, PAF, Session Units, Advanced Units, Prev Institute, Prev Program, App Status, Category, Placed"); gridsArray[winID].attachHeader("#text_filter_inc,#text_filter_inc,#text_filter_inc,#select_filter,#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter,#select_filter,#select_filter,#select_filter,#select_filter,#select_filter"); gridsArray[winID].setInitWidths("*,*,*,*,*,*,*,*,*,*,*,*,*"); gridsArray[winID].enableResizing("true,true,true,true,true,true,true,true,true,true,true,true,true"); gridsArray[winID].setColAlign("right,left,left,center,right,right,right,right,center,center,center,center,center"); gridsArray[winID].setColTypes("rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt,rotxt"); gridsArray[winID].setColSorting("str,str,str,str,int,int,int,int,str,str,str,str,str"); gridsArray[winID].attachEvent("onRowDblClicked", doOnRowDblClicked); gridsArray[winID].attachEvent("onResize",function(ind){ if (this.initCellWidth[ind]=="*") this.initCellWidth[ind]=100; return true; }) gridsArray[winID].attachEvent("onRightClick", function(id,ind,obj){ }); gridsArray[winID].enableContextMenu(menu2); gridsArray[winID].init(); gridsArray[winID].enableSmartRendering(true); gridsArray[winID].setSkin("dhx_skyblue"); gridsArray[winID].setImagePath("<?php echo $dhtml_path;?>/dhtmlxGrid/codebase/imgs/"); //grid.loadXML("<?php echo $dhtml_path;?>/dhtmlxWindows/samples/common/grid.xml") gridsArray[winID].load("get_json_data.php?type=stuInfo&syear=" + syear,'json'); } break; case "system_logout": dhtmlxAjax.post("ajax_process.php", "type=logout", null); window.location = "login_adm.php"; break; case "help_about": if (dhxWins.window("help_about_window")) { dhxWins.window("help_about_window").bringToTop(); dhxWins.window("help_about_window").setPosition(230, 140); } else { dhxWins.createWindow("help_about_window", 230, 140, 450, 300); dhxWins.window("help_about_window").setText("About"); dhxWins.window("help_about_window").denyResize(); dhxWins.window("help_about_window").button("stick").show(); dhxWins.window("help_about_window").setIcon("about.gif", "about.gif"); dhxWins.window("help_about_window").attachHTMLString(''); } break; case "": break; } //alert("Button "+id+" was clicked"); } function close_window(id) { dhxWins.window(id).close(); } function doOnRowDblClicked(id) { winID = "stuInfo_" + id + "_window"; if (dhxWins.window(winID)) { dhxWins.window(winID).bringToTop(); } else { dhxWins.createWindow(winID, startX, startY, 810, 650); startX = startX + 20; startY = startY + 20; if (startX > 230) { startX = 20; } if (startY > 140) { startY = 20; } dhxWins.window(winID).setText("Student Information - id " + id); dhxWins.window(winID).button("stick").show(); dhxWins.window(winID).setIcon("open.gif", "open.gif"); dhxWins.window(winID).attachURL("stu_info.php?id=" + id); } } </script> Answer posted by Alex (support) on Dec 10, 2009 06:52 Hello, the issue wasn't reproduced locally. Provide the complete demo to support@dhtmlx.com |