Ir al contenido

Binding

Defined in: binding/Binding.ts:17

A binding connects a model data property to a Part or GraphObject property.

When the model changes, the binding reads sourceProperty from the node data and writes it to targetProperty on the target.

For TwoWay bindings, changes to the target property are written back to the model.

new Binding(targetProperty, sourceProperty?, converter?): Binding

Defined in: binding/Binding.ts:27

GoJS-compatible: sourceProperty is optional and defaults to targetProperty; the optional third argument is the converter function.

string

string

(value, data) => unknown

Binding

get mode(): number

Defined in: binding/Binding.ts:73

GoJS-compatible: Get the mode (BindingMode.OneWay or BindingMode.TwoWay).

number

set mode(value): void

Defined in: binding/Binding.ts:68

GoJS-compatible: Set the mode to BindingMode.OneWay or BindingMode.TwoWay.

number

void


get sourceObjectName(): string

Defined in: binding/Binding.ts:48

The name of the source object (default “data”).

string


get sourceProperty(): string

Defined in: binding/Binding.ts:58

The model data property name to read.

string


get targetProperty(): string

Defined in: binding/Binding.ts:53

The target property name to set.

string


get twoWay(): boolean

Defined in: binding/Binding.ts:63

Whether this is a TwoWay binding.

boolean

applyToModel(target, nodeData): boolean

Defined in: binding/Binding.ts:116

Apply TwoWay: read target property and write back to model data. Returns true if the property was set on the model.

BindingTarget

NodeData

boolean


applyToPart(part, nodeData): boolean

Defined in: binding/Binding.ts:235

Part

NodeData

boolean


applyToTarget(target, nodeData): boolean

Defined in: binding/Binding.ts:100

Apply this binding: read from model data and set on the target. Returns true if the property was set.

BindingTarget

NodeData

boolean


copy(): Binding

Defined in: binding/Binding.ts:245

Create a deep copy of this binding.

Binding


equals(other): boolean

Defined in: binding/Binding.ts:226

Check if two bindings are equivalent.

Binding

boolean


getSourceValue(nodeData, target?): unknown

Defined in: binding/Binding.ts:140

Read the source property from model data, applying the converter if present. Supports dot paths (e.g. “data.name”, “meta.color”). Resolves the source object per ofObject(): “data” (default), “parent”, or a named GraphObject in the visual tree.

NodeData

BindingTarget

unknown


getSourceValueFromPart(part): unknown

Defined in: binding/Binding.ts:240

Part

unknown


getSourceValueFromTarget(target): unknown

Defined in: binding/Binding.ts:217

Read the target property and write to model data, applying back-converter if present.

BindingTarget

unknown


makeTwoWay(): this

Defined in: binding/Binding.ts:84

Make this a TwoWay binding so target property changes flow back to the model.

this


ofBackConverter(backConverter): this

Defined in: binding/Binding.ts:90

Set a back-converter for TwoWay bindings that transforms target property → model data.

(value, target) => unknown

this


ofConverter(converter): this

Defined in: binding/Binding.ts:78

Set a converter function that transforms model data → target property.

(value, data) => unknown

this


ofObject(name): this

Defined in: binding/Binding.ts:42

GoJS-compatible: Specify which object is the source of the binding. Common values: “data” (the part’s model data, the default), “parent” (the parent panel’s data). Named GraphObjects are resolved when possible.

string

this


setTargetValue(target, value): void

Defined in: binding/Binding.ts:210

Write a value to the target, applying the back-converter if present.

BindingTarget

unknown

void