Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Nodo Gojs conectado a la derecha

Quiero hacer que el árbol agregue un nuevo nodo siempre en el lado derecho de la lista por alguna razón por la que lo puso desde el lado izquierdo. mi diagrama init se ve así. ¿Hay una opción para hacerlo SIN comparador?

 "toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom, "undoManager.isEnabled": true, initialContentAlignment: go.Spot.TopCenter, initialAutoScale: go.Diagram.Uniform, hasHorizontalScrollbar: true, allowDelete: false, layout: $(go.TreeLayout, { angle: 90, nodeSpacing: 100, }), model: $(go.GraphLinksModel, { linkKeyProperty: "key", // IMPORTANT! must be defined for merges and data sync when using GraphLinksModel }), });

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No veo por qué no querrías configurar TreeLayout.comparer .

Pero una solución simple es configurar TreeLayout.sorting para go.TreeLayout.SortingReverse . Por ejemplo:

 <!DOCTYPE html> <html> <head> <title>Minimal GoJS Sample</title> <!-- Copyright 1998-2022 by Northwoods Software Corporation. --> </head> <body> <div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:600px"></div> <button id="myTestButton">Test</button> <script src="https://unpkg.com/gojs"></script> <script id="code"> const $ = go.GraphObject.make; const myDiagram = $(go.Diagram, "myDiagramDiv", { layout: $(go.TreeLayout, { angle: 90, sorting: go.TreeLayout.SortingReverse }) }); myDiagram.nodeTemplate = $(go.Node, "Auto", { locationSpot: go.Spot.Top }, $(go.Shape, { fill: "white" }, new go.Binding("fill", "color")), $(go.TextBlock, { margin: 8 }, new go.Binding("text")) ); myDiagram.model = new go.GraphLinksModel( [ { key: 1, text: "Alpha", color: "lightblue" }, { key: 2, text: "Beta", color: "orange" }, { key: 3, text: "Gamma", color: "lightgreen" }, { key: 4, text: "Delta", color: "pink" } ], [ { from: 1, to: 2 }, { from: 1, to: 3 }, { from: 3, to: 4 }, ]); document.getElementById("myTestButton").addEventListener("click", e => { let node = myDiagram.selection.first(); if (!node) node = myDiagram.nodes.first(); if (node instanceof go.Node) { myDiagram.model.commit(m => { const d = { text: "New Node", color: go.Brush.randomColor() }; m.addNodeData(d); const n = myDiagram.findNodeForData(d); if (n) n.location = node.location; m.addLinkData( { from: node.key, to: n.key }); }); } }); </script> </body> </html>

Haga clic en el botón "Probar" para agregar un nodo de árbol secundario al nodo seleccionado.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda