Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

210
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda