javascript - Using array as target in jsPlumb -
javascript - Using array as target in jsPlumb -
i trying create connections in jsplumb 1 source multiple targets. want define targets using array. however, whenever seek jsplumb chooses first item in array, rather using of them.
for example, define array using id's of 2 elements:
var test = ['s4', 's3'];
then, jsplumb create programmatic connection:
jsplumb.ready(function() { jsplumb.connect({ source:"element1", target: test, anchors:["left", "left" ], endpoint:"blank", /* note can create "image" if want fancy */ endpointstyle:{ fillstyle: "red"}, paintstyle:{strokestyle:"red", linewidth:3}, connector:[ "flowchart", { cornerradius:"200", stub:"40"} ] }); })
this ever creates connection between #element1 , #s4. getting wrong? can't find much documentation on how utilize array in context of programmatic connection.
try loop code multiple targets below:
var start = 'element1'; var end = ['s4','s3']; for(var i=0;i<end.length;i++) { jsplumb.connect({ source:start, target:end[i], connector:[ "flowchart", { cornerradius:"200", stub:"40"} ], paintstyle:{strokestyle:"red", linewidth:3}, endpointstyle:{ fillstyle: "red"}, anchors:["left", "left" ], endpoint:"blank" }) }
similar question: how connect multiple targets single source in jsplumb?
javascript arrays jsplumb
Comments
Post a Comment