I'm new in jsPlumb, I'm plaing with demos. I need not to allow the connection when the target or source is specify. I mean: when the target is X - connection can't be establish.
jsPlumb fires an event connection
when a connection is made.
jsPlumb.bind("connection", function(info) {
if(info.sourceId==='abc'){
jsPlumb.detach(info.connection);
}
});
info is an object with the following properties:
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
References :
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