Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Links and two-way data binding to nested property

$
0
0

@jsobell wrote:

The example at http://gojs.net/latest/samples/dynamicPorts.html shows how to do two-way binding assuming the data for the model is flat, but I'm trying to bind all positional information under a 'metadata' object in my model.

I can store and retrieve the location for nodes using the following code:
new go.Binding("location", "metadata", m => go.Point.parse(m.loc)).makeTwoWay((val, obj) => {
obj.metadata.loc = go.Point.stringify(val);
return obj.metadata;
}),

(although please tell me if there's a cleaner way)

but I can't see a sensible way of doing the same with the List. Is there a hook into the code used by the underlying Model.toJSON that can be used?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles