I am attempting to dispose of jsPlumb connections by detaching them and dragging them to a bin object. If the connection is dragged and dropped in the middle of nowhere, I would like the detach to fail and the connection to return to its initial position.
jsPlumb.bind("beforeDetach", function (e) {
//If not dropped in bin
return false;
});
I attempted to do this by using the beforeDetach event. However, this doesn't seem to fire when I expect. It does work correctly when using jsPlumb 1.3 however.
JsPlumb 1.3: http://jsfiddle.net/QULdZ/
JsPlumb 1.6: http://jsfiddle.net/pDpCx/
However, the API docs still mention this event :
beforeDetach(connection)
This event is fired when a Connection is about to be detached, for whatever reason. Your callback function is passed the Connection that the user has just detached. Returning false from this interceptor aborts the Connection detach.
What can I do to get this up and running?
I've asked the same question on the JSPlumb Google group - and it looks like this is a bug.
https://groups.google.com/forum/?fromgroups=#!topic/jsplumb/Udh9u-6BEHY
Issue raised: https://github.com/sporritt/jsPlumb/issues/223