Cannot use jsplumb with second function

I get my instance as follows:

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 am doing the same thing:

 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 all move left, the top corner ... var jsp is global, and I cleared _domnodeId at the beginning of my second function. Any suggestions?

cleaning my domnodeID:

 function clean(container){ //remove everything $("#" + container) .children() .not('nav') .remove(); // box id counter window.EvmClasses.chartBox.boxId = 0; } 
+7
javascript jsplumb
source share
1 answer

I cleared _domnodeId at the beginning of my second function

How did you do that? It seems to me that you did not understand it correctly.

Have you read "Uninstall" in the manual section?

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

Read it carefully. You may need jsPlumb.empty , deleteEveryEndpoint or reset .

+1
source share

All Articles