Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cytoscape.js disable grab&moving nodes

I'm having trouble building a graph network with cytoscapeJS. I can add nodes and handle them which is quite easy, but I'm not able to configure cytospace to disable Dragging/Moving nodes.

I have found a JSbin from somebody where you can try: http://jsbin.com/vasenatimu/2/edit?html,js,output

Have a look at http://js.cytoscape.org under 'Initialisation options', I tried all the options, but they dont solve my problem (I set nearly all options to false and I can still grab and select nodes).

Can you help me with this?

like image 737
ant45de Avatar asked May 14 '15 10:05

ant45de


2 Answers

initOptions.autoungrabify: true or cy.nodes().ungrabify()

like image 126
maxkfranz Avatar answered Oct 23 '22 11:10

maxkfranz


You can also disable selected nodes using their configuration. For example:

cytoscape({
  elements: {
    nodes: [
      { 
        data: { id: "node1" }, 
        grabbable: false,
      },
    ],
  },
});
like image 1
emil.c Avatar answered Oct 23 '22 13:10

emil.c