Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete jsPlumb connection

I am playing with jsplumb, but I am not able to delete the connection between two divs having only the id of one div.

like image 906
GigaPr Avatar asked Jul 14 '12 23:07

GigaPr


1 Answers

Firtsly, you can find your connection by using sourceId and targetId

var connections = jsPlumb.getConnections({
            source: sourceId ,
            target:targetId  
        });

This will return an array of jsPlumb connections, so you can delete all connections related to this source and target id.

for(var i=0;i < connections.length;i++) {
            jsPlumb.deleteConnection(connections[i]);
        }
like image 126
filippos lavdas Avatar answered Sep 30 '22 00:09

filippos lavdas