I am trying to use this context menu javascript library but can't seem to get it to trigger when a node is right clicked.
I tried implementing the basic demo and that works, so I have the necessary js on the page.
I added it to the left click of a node and tried to trigger the context menu through the custom way like so:
graph.$('node').on('cxttapstart', function (event) {
event.cyTarget.contextMenu();
});
$.contextMenu({
selector: '.context-menu-one',
trigger: 'none',
callback: function (key, options) {
var m = "clicked: " + key;
window.console && console.log(m) || alert(m);
},
items: {
"edit": { name: "Edit", icon: "edit" },
"cut": { name: "Cut", icon: "cut" },
"copy": { name: "Copy", icon: "copy" },
"paste": { name: "Paste", icon: "paste" },
"delete": { name: "Delete", icon: "delete" },
"sep1": "---------",
"quit": { name: "Quit", icon: function ($element, key, item) { return 'context-menu-icon context-menu-icon-quit'; } }
}
});
but I just don't know what to do on line
selector: '.context-menu-one'
so that the context menu shows up next to the node.
Anybody done this before?
Cheers