Nendil
Nendil

Reputation: 85

How to get the id of the node where I drop the node that I am dragging

I am trying to use the compound-drag-and-drop extension of cytoscape to create an event where I need the id of the node where I am dropping the node that I am dragging. Instead the id that I am getting is a "parent" auto generated by the extension. Is there a way to get the id of my node so I can bind both of them when I drop the first one into the second one?

Upvotes: 1

Views: 139

Answers (1)

Stephan T.
Stephan T.

Reputation: 6074

I think that is exactly what the custom event

cy.nodes().bind('cdnddrop', function (event, target){
    var grabbedNodeID = event.target._private.data.id;
    var droppedNodeID = target._private.data.id;
});

does, so try it out and see if it helps you.

Upvotes: 2

Related Questions