【问题标题】:jsPlumb - how to deny connection (detach) if target or source is specify?jsPlumb - 如果指定了目标或源,如何拒绝连接(分离)?
【发布时间】:2015-07-16 08:19:30
【问题描述】:

我是 jsPlumb 的新手,我正在使用 demos。指定目标或源时,我不需要允许连接。我的意思是:当目标是 X - 无法建立连接。

【问题讨论】:

  • 你能创造一个小提琴来玩吗?

标签: jsplumb


【解决方案1】:

jsPlumb 在建立连接时触发事件connection

jsPlumb.bind("connection", function(info) {
    if(info.sourceId==='abc'){
      jsPlumb.detach(info.connection);
    }

});

info 是一个具有以下属性的对象:

connection - the new Connection. you can register listeners on this etc.
sourceId - id of the source element in the Connection
targetId - id of the target element in the Connection
source - the source element in the Connection
target - the target element in the Connection
sourceEndpoint - the source Endpoint in the Connection
targetEndpoint - the targetEndpoint in the Connection

参考资料:

http://www.jsplumb.org/doc/events.html#evt-connection-detached http://www.jsplumb.org/doc/removing.html http://www.jsplumb.org/apidocs/classes/jsPlumb.html#method_detach

【讨论】:

  • 您可以通过点击tick接受它作为答案
猜你喜欢
  • 2022-01-12
  • 1970-01-01
  • 1970-01-01
  • 2013-08-16
  • 2015-03-01
  • 2016-11-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多