Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Gojs expanding and collpse tree nodes

I'm a new in Gojs, and this question is about the node expandind control in tree model.

I just wonder can I control the root node in different way to the other node in tree model.

Take the Gojs official code for example:

  $(go.Node, "Horizontal",
    $(go.Panel, "Auto",
      $(go.Shape, "Ellipse", { fill: null }),
      $(go.TextBlock,
        new go.Binding("text", "key"))
    ),
    $("TreeExpanderButton")
  );

diagram.layout = $(go.TreeLayout);

var nodeDataArray = [
  { key: "Alpha" }, { key: "Beta" }, { key: "Gamma" }, { key: "Delta" },
  { key: "Epsilon" }, { key: "Zeta" }, { key: "Eta" }, { key: "Theta" }
];
var linkDataArray = [
  { from: "Alpha", to: "Beta" },
  { from: "Beta", to: "Gamma" },
  { from: "Beta", to: "Delta" },
  { from: "Alpha", to: "Epsilon" },
  { from: "Epsilon", to: "Zeta" },
  { from: "Epsilon", to: "Eta" },
  { from: "Epsilon", to: "Theta" }
];
diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);

and we will get the tree like1

How can I remove the treeExpanderButton on the root node only, and keep the root node be expanded ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!