DEMOS
DOCS
FEATURES
DOWNLOAD
PURCHASE
CONTACT
BLOG
Show:

jsPlumbToolkit.Support Class

Support functionality for working with existing jsPlumb instances in the Toolkit. Using the ingest method in this class, you can ingest an existing jsPlumb instance into a new instance of the Toolkit; this for many people may prove to be a logical upgrade path from their existing jsPlumb code.

When you ingest an existing jsPlumb instance, its Container is configured to be a Surface widget, which makes it pannable and zoomable, and the set of Nodes and Edges it is managing are loaded into the Toolkit's data model.

Item Index

Methods

Methods

ingest

(
  • params
)
JsPlumbToolkitInstance | Surface static

Ingests an existing jsPlumb instance into a new Toolkit instance, and turns the instance's Container into a Surface. Every element that is the source or target of a Connection is added to the Toolkit instance as a Node, and every Connection is added as an Edge. You can provide your own functions for determining the id and type of Nodes and Edges, if you need to. This method will throw an error if your jsPlumb instance does not have a Container set; it is a requirement for the Surface widget.

Parameters:

  • params Object

    Method parameters.

    • [jsPlumb] JsPlumbInstance optional

      The instance of jsPlumb to ingest. If null, it uses the static jsPlumb window instance.

    • [nodeSelector] String optional

      Optional selector to identify elements that may not yet be managed by jsPlumb but which you would like to have imported as Nodes.

    • [idFunction] Function optional

      A function to use to extract the id from elements that are being loaded as Nodes. If null, the default behaviour is to ask the jsPlumb instance for the element's id attribute.

    • [typeFunction] Function optional

      A function to use to extract the type from elements that are being loaded as Nodes. If null, the default behaviour is to use default as the Node type.

    • [edgeIdFunction] Function optional

      A function to use to extract the id from Connections that are being loaded as Edges. If null, the default behaviour is to use the Connection's id.

    • [edgeTypeFunction] Function optional

      A function to use to extract the type from Connections that are being loaded as Edges. If null, the default behaviour is to use default as the Edge type.

    • [renderParams] Object optional

      Parameters to pass to the Surface constructor.

    • [render=true] Boolean optional

      If false, this method returns only a Toolkit instance with data loaded, and doesn't create a Surface renderer for it.

Returns:

JsPlumbToolkitInstance | Surface:

A Surface instance whose underlying Toolkit has been loaded with the contents of the jsPlumb instance (you can access the Toolkit itself via surface.getToolkit()), or, if render was set to false, a jsPlumbToolkitInstance..