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

Add groups to JSON feed

$
0
0

@kasga wrote:

Hi guys,
first of all, thank you for a great library, I think it really fulfills all of my needs for my next project ... hopefully;)

I've set up the Flowchart example, and would like to add groups to the JSON feed, so that I can expand/collapse groups and save those settings in a database.

  1. I've added the TreeExpanderButton to the NodeTemplateMap.
  2. Then I've added the

myDiagram.groupTemplate = $(go.Group, go.Panel.Auto, {
      minSize: new go.Size(50, 100)
    }, new go.Binding("location", "location", go.Point.parse).makeTwoWay(go.Point.stringify), $(go.Shape, {
    fill: null,
      stroke: "blue",
      strokeWidth: 2
    }),
    $(go.Panel, go.Panel.Table, {
        name: "TABLE",
        margin: 0
      },
      new go.Binding("visible", "isSubGraphExpanded").ofObject(),
      $(go.Placeholder, {
        row: 1,
        background: "transparent",
        padding: 5
      })),
    $("SubGraphExpanderButton", {
      alignment: new go.Spot(0, 0)
    }));
  1. And then the two way databinding
    new go.Binding("isSubGraphExpanded", "expanded").makeTwoWay(),

but when I "Save" the JSON feed and "Load" it again, the nodes are not collapsed

Thanks
Kasper

Posts: 12

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles