How to connect to endpoint using jsplumb?

冷暖自知 提交于 2019-12-12 03:36:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!