This page contains a summary of some common scenarios you may find when using jsPlumb, and what functions jsPlumb offers to help you.
Assuming you use jsPlumb.draggable
to initialise your draggable elements, you do not typically need to instruct jsPlumb to repaint. However, there are times when you need to, for instance:
jsPlumb.draggable
to initialise some draggable element.To force a repaint, use:
jsPlumb.repaint(el, [ui])
The first argument - el
- can be a number of different datatypes:
Notice the ui
argument? This is an offset in the form:
{ left:X, top:Y }
...which, if provided, means that jsPlumb does not have to go and compute the offset of the element.
Note this is of course relevant only if you are repainting a single element. If you provide this when you're painting multiple elements, they will all be assumed to be at the given offset!
To repaint everything:
jsPlumb.repaintEverything();
jsPlumb uses element ids as keys for Connections and Endpoints, so if an element id changes, jsPlumb needs to know about it. You can either have jsPlumb do it for you:
jsPlumb.setId(el, newId);
or tell jsPlumb about it afterwards:
jsPlumb.setIdChanged(oldId, newId);