jsPlumb - как запретить подключение (отключить), если указана цель или источник?

Я новичок в jsPlumb, я знаком с демо. Мне не нужно разрешать соединение, когда указана цель или источник. Я имею в виду: когда цель X - соединение не может быть установлено.


person bartekch    schedule 06.05.2015    source источник
comment
Вы можете создать скрипку для игры?   -  person coding_idiot    schedule 08.05.2015


Ответы (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

person coding_idiot    schedule 08.05.2015
comment
вы можете принять его как ответ, нажав на tick - person coding_idiot; 11.05.2015