Context menu for dependency links


#1

Hi,

Can we create a context menu for dependency links? We need to be able to have add/edit/delete options when we right click the dependency link.

Thanks,
Kevin.


#2

Hi!

The gantt library doesn’t have a built-in context menu component, so you’ll have to use a 3rd party library for it.

As for capturing the right-click event, you can use “onContextMenu” event of the gantt and call the context menu from the handler
https://docs.dhtmlx.com/gantt/api__gantt_oncontextmenu_event.html

returning ‘false’ from the handler will prevent the native menu:

gantt.attachEvent("onContextMenu", function (taskId, linkId, event) {
    var element = event.target;
    if(gantt.isLinkExists(linkId)){
       alert("right click on link " + linkId);
       return false;// prevent native context menu
    }
    return true;
});

http://snippet.dhtmlx.com/5/f51a34ba6