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

Access property of parent group from template

$
0
0

@MichaelPolla wrote:

Hello,

Is it possible to access a property of the parent group from within a template that is used for subgroups ?
I though about using containingGroup but I didn’t find how.

Here an example of what I’d like to achieve. Subgroup text would be of the color value from the parent group, MainGroup.

var nodeDataArray = [
    // Groups
    { key: "MainGroup", isGroup: true, color: "red"},
    { key: "Subgroup", isGroup: true, group: "MainGroup", category: "subgroup" },
];

var subgroupTemplate =
    $(go.Group, "Vertical",
        $(go.TextBlock,
            { alignment: go.Spot.Left },
            new go.Binding("text", "key"),
            new go.Binding("stroke", >>>containingGroup.color<<<))
);

diagram.groupTemplateMap.add("subgroup", subgroupTemplate);

Best regards,

Michaël Polla

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles