I am having the same issue as was discussed in this stack overflow, but the fixes there aren't working for me
https://stackoverflow.com/questions/15147291/jsplumb-delete-a-draggable-element.
I am using version 2.12.5 and really am not able to update (to any version with non-backward compatible changes) at this time.
Here is a summary of what I am doing. I am dynamically adding child endpoints to an element. These child elements are bound to a list and the user can remove them. On removing a child I need to remove any connections to it (it will only have a source endpoint) and then I need to also remove the endpoint itself - the entire child must be gone.
To remove, I am iterating through all of my connections and looking for any that are tied to this endpoint, then removing them like this.
jsPlumbInstance.deleteConnection(jsPlumbConnection);
Next, I am deleting the endpoint(s) like this: jsPlumbInstance.removeAllEndpoints(id);
I can see that the total number of endpoints is reduced as expected. However, now, when I try to resize the parent element, the following code in the DragManager still has some child elements that no longer exist.
In the snippet below, the _delements[id] is returning children that should not exist. How do I make these go away?
// refresh the offsets for child elements of this element.
this.updateOffsets = function (elId, childOffsetOverrides) {
if (elId != null) {
childOffsetOverrides = childOffsetOverrides || {};
var domEl = jsPlumb.getElement(elId),
id = _currentInstance.getId(domEl),
children = _delements[id],
parentOffset;
Discovered that calling remove on the entire element instead of trying to remove the connections and endpoints manually did the trick. Not an issue with the code, it was my approach. Closing.
*Edit - cleaned up the text for easier reading.
I am having the same issue as was discussed in this stack overflow, but the fixes there aren't working for me https://stackoverflow.com/questions/15147291/jsplumb-delete-a-draggable-element. I am using version 2.12.5 and really am not able to update (to any version with non-backward compatible changes) at this time.
Here is a summary of what I am doing. I am dynamically adding child endpoints to an element. These child elements are bound to a list and the user can remove them. On removing a child I need to remove any connections to it (it will only have a source endpoint) and then I need to also remove the endpoint itself - the entire child must be gone.
To remove, I am iterating through all of my connections and looking for any that are tied to this endpoint, then removing them like this. jsPlumbInstance.deleteConnection(jsPlumbConnection); Next, I am deleting the endpoint(s) like this: jsPlumbInstance.removeAllEndpoints(id);
I can see that the total number of endpoints is reduced as expected. However, now, when I try to resize the parent element, the following code in the DragManager still has some child elements that no longer exist.
In the snippet below, the _delements[id] is returning children that should not exist. How do I make these go away?