Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jsplumb add connection programmatically using endpoints

My requirement is like, I am adding two endpoints using jsplumb.addEndPoint for two containers named 'container0' and 'container1'.

Now I need to link the two end points using a connector programmatically but the jsplumb.connect creates a new endpoint and connecting and is not using the end point which I have created using jsplumb.addEndpoint .

How could I connect these two end points? Also I just want to add a connection if the connection is not already there for the end points?

like image 457
user1994513 Avatar asked Mar 21 '23 07:03

user1994513


1 Answers

To connect using already existing endpoints you can make use of the Uuid's of the endpoints:

jsPlumb.ready(function () {  
    var e0 = jsPlumb.addEndpoint("container0",{uuid:"ep1"}),  //set your own uuid for endpoint for later access.
    e1 = jsPlumb.addEndpoint("container1",{uuid:"ep2"});  
    jsPlumb.connect({ uuids:[e1.getUuid(),e2.getUudi()] }); // (or) jsPlumb.connect({ uuids:["ep1","ep2"] });
});
like image 164
MrNobody007 Avatar answered Apr 07 '23 22:04

MrNobody007