这是我在StackOverflow上的第一个问题。
我目前正在使用jsPlumb来制作一种图表。图中的每个节点可以有多个输入和输出,因此我在每个端点上标记并放置了一个uuid:
jsPlumb.addEndpoint("name of node",
{
anchor : [0,0.75,-1,0],
overlays : [ ["Label", {label : "name of input", uuid : "name of input", location : [3.5,0.5]}] ]
}, targetEndpointOptions);
然后,我尝试使用此函数获取端点的标签或uuid:
function getConnexions()
{
var connected = jsPlumb.getConnections();
$.each(connected, function(id, connection)
{
console.log(connection.source);
console.log(connection.target);
console.log(connection.endpoints[0].getUuid());
$.each(connection.endpoints, function(id, endpoint)
{
console.log(endpoint.getLabel());
})
})
}
正如你所看到的,我已经尝试了两种不同的方法来处理标签和uuid。但这不起作用,我在控制台中要么未定义,要么为null。有人能帮帮忙吗?
非常感谢
发布于 2018-07-16 09:11:48
您已将uuid放在标签上,而不是放在端点上。如果您尝试将uuid放在端点上,请尝试:
jsPlumb.addEndpoint("name of node",
{
anchor : [0,0.75,-1,0],
uuid : "name of node",
overlays : [ ["Label", {label : "name of input", location : [3.5,0.5]}] ]
}, targetEndpointOptions);
https://stackoverflow.com/questions/49942460
复制相似问题