Occasionally I get an error when I load a grid with a context menu. This happens usually the first time the page is loaded and every time after that I refresh the page, this error does not appear. Refresh of the page, will mostly load the page properly without any error, but I do get the same error once every few refresh attempts.
I am using dhtmlxmenu version 1 (and IE-8). The error seems to appear at the time of initialization of the menuobject:
The grid has a context menu.
Message: ‘this.parentItem’ is null or not an object
Line: 18
Char: 2
Code: 0
URI: …/scripts/dhtmlx/dhtmlxMenu/codebase/dhtmlxmenubar.js
Code:
// – Define Context Menu
var shMenu;
shMenu=new dhtmlXContextMenuObject(‘120’,0,’…/imgs’);
shMenu.menu.setGfxPath("…/…/scripts/dhtmlx/dhtmlxMenu/codebase/imgs/");
shMenu.setContextMenuHandler(selectShiftMenuOption);
shMenu.setContextZone(‘sp_shiftGrid’,2);
shMenu.menu.loadXML(“dhtmlxmenu_dls1.xml”);
shiftGrid = new dhtmlXGridObject(‘sp_shiftGrid’);
shiftGrid.setHeader(“Start, Activity,”);
shiftGrid.setNoHeader(true);
shiftGrid.setInitWidths(“80,*,5,5”);
shiftGrid.setColAlign(“left,left,left,left”);
shiftGrid.setColTypes(“coro,coro,ro,ro”);
shiftGrid.setColSorting(“str,str,str,ro”);
shiftGrid.setSkin(“xp”);
shiftGrid.enableAutoHeight(true,“400”);
shiftGrid.enableContextMenu(shMenu);
shiftGrid.enableLightMouseNavigation(true);
shiftGrid.enableRowsHover(true,‘lay_grid_hover’);
shiftGrid.enableTooltips(“false,false,false,false”);
shiftGrid.init();
Menu XML:
<?xml version='1.0' ?>
Thanks
The issue wasn’t reproduced locally. Could you please send us the complete demo to re-create the issue (it can be sent to support@dhtmlx.com)