Skip to main content

Home > @jsplumbtoolkit/browser-ui > Surface > activateState

Surface.activateState() method#

Activates the UI state with the given ID on the objects contained in the given target. If target is not supplied, the state is activated against the entire dataset.


activateState(stateId: string, target: Selection | Path | JsPlumbToolkit | Element): void;


stateIdstringID of the state to activate. States are defined inside a states member of your view definition.
targetSelection | Path | JsPlumbToolkit | ElementSet of objects to activate the state on. If null, the entire dataset (Nodes, Edges, Groups and Ports) is used. If you provide an Element here, a Selection is created that consists of the Node representing the element, plus all Edges to and from the given Node.