1、连接:
jsPlumb.bind("connection", function (connInfo, originalEvent) {
if (connInfo.connection.sourceId == connInfo.connection.targetId) {
jsPlumb.detach(connInfo);
alert("不能连接自己!");
}else{
alert("连接"+connInfo.connection.sourceId+"==="+connInfo.connection.targetId);
}
});
2、连接取消
jsPlumb.bind("connectionDetached", function (conn, originalEvent) {
if (conn.sourceId == conn.targetId) {
//自己连接自己时会自动取消连接
}else{
alert("删除连接从" + conn.sourceId + "到" + conn.targetId + "!");
}
});
3、点击
jsPlumb.bind("click", function (conn, originalEvent) {
if (confirm("Delete connection from " + conn.sourceId + " to " + conn.targetId + "?"))
jsPlumb.detach(conn);
});
4、删除
jsPlumb.removeAllEndpoints("window");