Categories | Question details Back To List | ||
DHTMLXContextMenu: 'this.setGfxPathA' is null or not an Object This error just won't stop bothering me... I guess it comes from somewhere here *dhtmlxmenubar.js* and very probably is something pretty silly but I just can't put my finger on it... function dhtmlXMenuBarObject(htmlObject,width,height,name,vMode,gfxPath,httpsdummy){ if (typeof(htmlObject)!="object") this.parentObject=document.getElementById(htmlObject); else this.parentObject=htmlObject; if (!this.parentObject) this.parentObject=document.body; this.setGfxPathA=this.setGfxPath; this.setGfxPath=function(){ this.setGfxPathA.apply(this,arguments); var self=this; dhtmlXMenuItemObject.prototype.dummyImg=function(){ return self.sysGfxPath+"blank.gif"} }; I use the following code in my script: cMenu=new dhtmlXContextMenuObject('120',0, "some folder"); Thanks Answer posted by Support on Apr 02, 2008 01:50 In which order you are including js files on your page? The correct one is dhtmlxcommon.js dhtmlxprotobar.js dhtmlxmenubar.js if you are using different order of files ( protobar after menubar ) - the mentioned issue may arise. Answer posted on Apr 02, 2008 03:24 I am using the context menu on the dhtmlxtree component meaning that I have all the following includes: <script language="javascript" type="text/javascript" src ="../includes/dhtmlxTree/codebase/dhtmlxcommon.js"></script> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxTree/codebase/dhtmlxtree.js"></script> <!-- script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxcommon.js"></script--> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxmenubar.js"></script> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxprotobar.js"></script> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxmenubar_cp.js"></script> Btw, which one of the dhtmlxcommon should I use first? At first glance, I would say they should be the same and the order has no importance, but since they are different inside (some slight changes), I am not that sure about that... Answer posted on Apr 02, 2008 03:35 I switched the order but still can't execute this: function getInitialTree(){ initDhtmlXContextMenu(); tree=new dhtmlXTreeObject('treeBox',"100%","100%",0); tree.enableContextMenu(cMenu); ... } function initDhtmlXContextMenu() { cMenu=new dhtmlXContextMenuObject('120',0); //create menu item var item = new dhtmlXMenuItemObject("Refresh Tree","Tree","1","","contextMenu"); cMenu.menu.addItem(cMenu.menu,item); } It gives me an "Object doesn't support this property or method" exception Answer posted on Apr 02, 2008 04:03 Precision: It complains about the tree.enableContextMenu() method because when commented everything runs just fine; Answer posted on Apr 02, 2008 04:43 I switched the order but still can't execute this: function getInitialTree(){ initDhtmlXContextMenu(); tree=new dhtmlXTreeObject('treeBox',"100%","100%",0); tree.enableContextMenu(cMenu); ... } function initDhtmlXContextMenu() { cMenu=new dhtmlXContextMenuObject('120',0); //create menu item var item = new dhtmlXMenuItemObject("Refresh Tree","Tree","1","","contextMenu"); cMenu.menu.addItem(cMenu.menu,item); } It gives me an "Object doesn't support this property or method" exception Answer posted on Apr 02, 2008 04:45 I am using the context menu on the dhtmlxtree component meaning that I have all the following includes: <script language="javascript" type="text/javascript" src ="../includes/dhtmlxTree/codebase/dhtmlxcommon.js"></script> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxTree/codebase/dhtmlxtree.js"></script> <!-- script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxcommon.js"></script--> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxmenubar.js"></script> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxprotobar.js"></script> <script language="javascript" type="text/javascript" src ="../includes/dhtmlxMenu/codebase/dhtmlxmenubar_cp.js"></script> Btw, which one of the dhtmlxcommon should I use first? At first glance, I would say they should be the same and the order has no importance, but since they are different inside (some slight changes), I am not that sure about that... Answer posted on Apr 02, 2008 05:48 Well, I see... For some reason, the method enableContextMenu() wasn't shipped with the dhtmlxtree.js library; It's probably a licence issue of some kind :-) Nevertheless, having the source code in front of me, I managed to add a little method enableContextMenu() on my one which basically just assigns the new menu value to the one inside the tree; that way I manage to get my popup menu popping :-) The problem is that whenever I try to click on it or anywhere else for that matter, nothing happens and the same exception Object doesn't support this property or method exception arises. What am I missing? Here is the code: function initDhtmlXContextMenu() { cMenu=new dhtmlXContextMenuObject('150',0, "MyOhMy"); var item = new dhtmlXMenuItemObject("TreeMenu","One","1","","contextMenu"); cMenu.menu.addItem(cMenu.menu,item); cMenu.setContextMenuHandler(onMenuClick); } function onMenuClick(idNode,idZone){ alert("yeah"); } Answer posted on Apr 02, 2008 07:22 I found the problem; Here is the bug you, guys, are certainly very much aware of: //dhtmlXMenuBarObject.prototype.correctMenuPosition=dhtmlXContextMenuObject.prototype.correctMenuPosition; This thing has got to be commented in the dhtmlxmenubar_cp.js file!!! Geee man. Thanks. Answer posted by Support on Apr 02, 2008 08:40 >>For some reason, the method enableContextMenu() wasn't shipped with the dhtmlxtree.js library; Yes, this functionality available only in pro version, but it doesn't do any magic, it just use menu.setContextZone(... against tree items, so it can be reflected with custom code. >>This thing has got to be commented in the dhtmlxmenubar_cp.js file!!! Actually if you have order of js includes as dhtmlxmenubar.js dhtmlxmenubar_cp.js on moment of line executing the dhtmlXMenuBarObject and dhtmlXContextMenuObject.prototype.correctMenuPosition are both defined, so it must not cause any problem ( the online samples use the same version of code by the way ) We will double-check the code, but so far it seems correct ( in any case, commenting this line will not break any important functionality ) |