We're working on a project that uses JSPlumb for workflow rendering and maintaining a separate data model that includes nodes (id, position, text etc.) and connections, keeping this in sync with events using jsPlumb.bind
When I come to recreate my connections I'm calling jsPlumb.connect with source and destination parameters but it seems that the ID is created behind the scenes and therefore doesn't match what was loaded from the data model. This would be fine except on detatching I wan't to remove that connection by ID from the model...
Is there any way to set the ID of a connector manually?
Thanks
You can set the id directly from the connection:
var conn=jsPlumb.getConnections({
scope:'myScope",
source:"mySourceElement",
target:"myTargetElement"
});
conn.id=elem.connectionId;
From the API Documents I couldn't find function for getting Connections with attribute ID, even though you can set ID to connection using setParameter
(API DOC). Instead you can remove the connection with sourceId and targetId rather than by connection ID.
var conn=jsPlumb.getConnections({
scope:'myScope",
source:"mySourceElement",
target:"myTargetElement"
});
jsPlumb.detach(conn,param) //by default param is false which defines whether to fire event on connection detach
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With