Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by denis moret on Feb 10, 2009 07:25
open dhtmlx forum
onRightClick event and ContextMenu

Hi,

I can't manage to attach the "onRightClick" event to my TreeGrid without killing my context menu. If I do not attach the event, the context menu works fine, as soon as I attach the event, the event is fired but the context menu does not show up anymore.
I tried with events onRightClick and onBeforeContextMenu, the same problem. What I would like to have is when the user right clicks on a row, this row is selected and the context menu appears:

    treeGridContextMenu=new dhtmlXContextMenuObject('120',0,treeGridContextMenuImageFolder);
    treeGridContextMenu.menu.loadXML(contextMenuXML);
    treeGridContextMenu.setContextMenuHandler(onButtonClick);

    repositoryTreeGrid = new dhtmlXGridObject(treeGridDiv);
    repositoryTreeGrid.enableContextMenu(treeGridContextMenu)
    repositoryTreeGrid.attachEvent("onRowSelect",doOnRowSelected);
    repositoryTreeGrid.attachEvent("onRightClick",doOnRightClick);
    repositoryTreeGrid.init();
    repositoryTreeGrid.loadXML(treeStrucutreXML);     

    function doOnRightClick(rowId,cellInd,ev)
    {
        repositoryTreeGrid.selectRowById(rowId);
    }
Answer posted by dhxSupport on Feb 10, 2009 08:06

Should be:

function doOnRightClick(rowId,cellInd,ev) 
  { 
  repositoryTreeGrid.selectRowById(rowId); 

return true;
  }