Multiple action inside onContextMenu

Hello guys,

I’m using dhtmlxGantt for several weeks now and it’s great. But … I ran into a complication with the onContextMenu event. See, I would like to process 2 actions in this event but, for some reason, I’m not able to do it. I try with several pieces of code :

_dhxGantt.attachEvent("onContextMenu", function (taskId, linkId, event) {
            dhxMenuHelper.createAndShow(taskId, event);
            if (taskId) {
                _dhxGantt.selectTask(taskId);
            }

            return false;
        });

or even :

_dhxGantt.attachEvent("onContextMenu", function (taskId, linkId, event) {
            dhxMenuHelper.createAndShow(taskId, event);
        });

_dhxGantt.attachEvent("onContextMenu", function (taskId) {    
            if (taskId) {
                _dhxGantt.selectTask(taskId);
            }
        });

Everytime, the same thing happens:

  • if I’m NOT on a task => everything good (open the contextMenu, doesn’t select a task)
  • if I’m on a task
    -> first right click: selected the task
    -> second right click: open contextMenu
    So … I’m doing something wrong ? Is there any conflict between event ?
    Thanks in advance