问题
I am using JSplumb for connections, I am getting some data from JSON and based on that I want to make connection between two endpoints, I have already created structure and created endpoints on each node, I tried to find this on jsplumb documentation but couldn't..
回答1:
At the time of adding endpoints make sure that you also assign them Uuid based on the element it is placed on. You can connect two endpoints in jsPlumb as:
jsPlumb.ready(function () {
var e0 = jsPlumb.addEndpoint("container0",{uuid:"ep0"}), //set your own uuid for endpoint for later access.
e1 = jsPlumb.addEndpoint("container1",{uuid:"ep1"});
jsPlumb.connect({ uuids:[e0.getUuid(),e1.getUudi()] });
// (or)
jsPlumb.connect({ uuids:["ep0","ep1"] });
});
来源:https://stackoverflow.com/questions/14518763/how-to-connect-to-endpoint-using-jsplumb