iVis-at-Bilkent / cytoscape.js-context-menus

A Cytoscape.js extension to provide context menu around elements and core instance
MIT License
87 stars 41 forks source link

Trigger context menus only for nodes. #63

Closed jonng1000 closed 2 years ago

jonng1000 commented 2 years ago

Hi, how do I trigger context menus only for nodes?

I did:

  cy.on('tap', 'node', function (evt) {
    evt.target.contextMenus()
    /*
    evt.target.popper({
      content: () => {
        let div = document.createElement("div");
        div.innerHTML = "Popper content";
        document.body.appendChild(div);
        return div;
      },
      popper: {} // my popper options here
    });
   */

But had a TypeError: evt.target.contextMenus is not a function

Could I get detailed instructions on how to trigger this for only nodes please? If Iuse the popper code above, it seems to work.

Thank you Jonathan

jonng1000 commented 2 years ago

Oh, and I also want to display node attributes in the menu. Thanks =)

hasanbalci commented 2 years ago

A request for help or a request for a how-to should be directed to Stack Overflow: http://stackoverflow.com/questions/tagged/cytoscape.js