7

I'm getting my instance like this:

jsp  = jsPlumb.getInstance();
jsp.setContainer(_domnodeId);
jsp.ready(function(){

//doing some stuff - connecting boxes with arrows...

    var conn2 = jsp.connect({
                source:     boxSST_IPMRS_COBRAIP.boxId,
                target:     boxCOBRA_IM.boxId
            });
    }

result:

enter image description here

in another function I'm doing the same:

jsp  = jsPlumb.getInstance();
jsp.setContainer(_domnodeId);

    jsp.ready(function(){   
        //var dynamicAnchor = [ [ 0.2,1,0.5 ],  [ 0.2, 1, 0.5 ], "Top", "Bottom" ];
        var common = {
                  anchor:[ "Continuous", { faces:["bottom","right"] }],
            endpoint:   "Blank",
            connector:[ "Bezier", { curviness:50 }, common ],
            overlays:   [
                            ["Arrow", {location:1, width:10, length:10}],
                        ]
            };

        jsp.connect({
            source: boxes.b1.boxId,
            target: boxes.b2.boxId
        }, common);
}

enter image description here

The arrows are all moving to the left,top corner... var jsp is global and I cleared _domnodeId at the beginning of my second function. Any suggestions?

clearing my domnodeID:

function clean(container){
    //remove everything
    $("#" + container)
            .children()
            .not('nav')
            .remove();

    // box id counter
    window.EvmClasses.chartBox.boxId = 0;
}
h0ppel
  • 347
  • 2
  • 5
  • 21
  • Just wondering, what happens if you remove `faces:["bottom","right"]` from the anchor? I haven't tested this yet, and It's just a plain assumption from someone who never use jsplumb before. – choz Jan 04 '16 at 08:35
  • 1
    Can you post a bit more code, or even better create a [jsbin](https://jsbin.com/?html,output) or [jsfiddle](https://jsfiddle.net/t) for this? – cviejo Jan 06 '16 at 10:37

1 Answers1

1

I cleared _domnodeId at the beginning of my second function

How did you done that? It seems to me that you didn't clear it properly.

Did you read "Removing" section of the manual?

If you have configured a DOM element with jsPlumb in any way you should use jsPlumb to remove the element from the DOM (as opposed to using something like jQuery's remove function, for example).

Please read it thoroughly. You may need either jsPlumb.empty, deleteEveryEndpoint, or reset.

user
  • 23,260
  • 9
  • 113
  • 101
  • I tried: jsPlumb.detachEveryConnection(); jsPlumb.deleteEveryEndpoint(); jsPlumb.reset(); jsPlumb.empty(); jsPlumb.empty();... all with no effect – h0ppel Jan 11 '16 at 13:35
  • In the code that you've added to the question you are removing via jQuery's `remove`, which is wrong. It's clearly stated that you shouldn't remove jsPlumb elements in that way. Have you tried those functions *instead* of jQuery's `remove`? Either that should help or removing individual elements via `jsPlumb.remove("element1");`, as said in the manual. – user Jan 11 '16 at 13:57
  • Did you run those functions on jsPlumb's instance, `jsp`? And `empty` requires an argument, in your case that would be like `jsp.empty(container);` – user Jan 11 '16 at 14:06