Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Amb on Nov 21, 2008 09:02
open dhtmlx forum
Context menu in grid

Hi,

I'm having difficulty getting a context menu on the grid working. No menu appears and the browser reports an error. Below is the error report from firebug, my Javascript setup and the XML the server returns.

el.a is not a function
_doContClick(mousedown clientX=0, clientY=0)dhtmlx.js (line 234)
onmousedown(mousedown clientX=0, clientY=0)dhtmlx.js (line 446)
[Break on this error] this.contextID=el.parentNode.idd+"_"+el._cellIndex;this._ctmndx._skip_hide=true...

var IndividualContactHistoryListGridMenu;
var IndividualContactHistoryListGrid;
var IndividualContactHistoryListGridAjaxHandler = "?wicket:interface=:0:ContactHistory:IndividualContactHistoryList::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true" + "&stopCacheHack=" + new Date().getTime();

function onShowMenuIndividualContactHistoryListGrid (rowId, celInd, grid) {    
    IndividualContactHistoryListGridMenu.loadXML(IndividualContactHistoryListGridAjaxHandler + "&requestType=contextMenu&rowID=" + rowId);
    return true;
}

function initIndividualContactHistoryListGrid () {
    IndividualContactHistoryListGridMenu = new dhtmlXMenuObject(    );
    IndividualContactHistoryListGridMenu.setImagePath("../dhtmlx/imgs/");
    IndividualContactHistoryListGridMenu.renderAsContextMenu();
    IndividualContactHistoryListGridMenu.setOpenMode("web");    
    
    
    IndividualContactHistoryListGrid = new dhtmlXGridObject("IndividualContactHistoryList3");
    IndividualContactHistoryListGrid.setImagePath("../dhtmlx/imgs/");
    IndividualContactHistoryListGrid.preventIECaching(true);
    IndividualContactHistoryListGrid.enableSmartRendering(true);
    IndividualContactHistoryListGrid.enableColumnMove(true);
    IndividualContactHistoryListGrid.attachHeader(",#select_filter,#text_filter,#select_filter");
    IndividualContactHistoryListGrid.setHeader("Date,Type of Contact,Description,Who");
    IndividualContactHistoryListGrid.setInitWidths("100,100,300,50");
    IndividualContactHistoryListGrid.setColumnIds("column1,column2,column3,column4");
    IndividualContactHistoryListGrid.setColSorting("date,na,na,na");
    IndividualContactHistoryListGrid.setColAlign("left,left,left,left");
    IndividualContactHistoryListGrid.setColTypes("ro,ro,ro,ro");
    IndividualContactHistoryListGrid.enableTooltips("false,false,false,false");
    IndividualContactHistoryListGrid.enableContextMenu("IndividualContactHistoryListGridMenu");

    IndividualContactHistoryListGrid.attachEvent("onBeforeContextMenu",onShowMenuIndividualContactHistoryListGrid);

    IndividualContactHistoryListGrid.init();
    IndividualContactHistoryListGrid.enableHeaderMenu();
    IndividualContactHistoryListGrid.setSkin("light");    
}



<?xml version="1.0" encoding="UTF-8"?>
<menu>
<item id="hello" text="hello" />
</menu>

Answer posted by Support on Nov 21, 2008 10:20
The next line is incorrect
  IndividualContactHistoryListGrid.enableContextMenu("IndividualContactHistoryListGridMenu");
It must be a
  IndividualContactHistoryListGrid.enableContextMenu(IndividualContactHistoryListGridMenu);