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

202
Views
Problema para presentar el árbol con treant js en Symfony, en caso de que la estructura del árbol sea una matriz de objetos

Quiero crear un árbol con treant.js, la forma de la estructura es así:

 var tree_structure=[ {container: '#OrganiseChart8', levelSeparation: 70, siblingSeparation: 60, nodeAlign: 'BOTTOM', connectors: { type: "step", style: { "stroke-width": 2, "stroke": "#ccc", "stroke-dasharray": "--", } }, {innerHTML: '#first-post'}, {parent: {innerHTML: '#first-post'}, innerHTML: '#1-reply'}, {parent: {innerHTML: '#first-post'}, innerHTML: '#2-reply'} }]; new Treant(tree_structure);

mostrar este código me da un solo nodo, que es el resultado de ({innerHTML: '#first-post'}) en caso de que haga cada código de nodo en una variable, todo va bien, así:

 var first= {innerHTML: '#first-post'}, child1 ={ parent: first, innerHTML: '#1-reply'}, child2 ={ parent: first, innerHTML: '#2-reply'}; var tree_structure=[first,child1,child2]; new Treant(tree_structure);

El resultado me da una visualización de tres nodos. observación: en mi caso, el árbol dinámico (nodos procesados a través de una base de datos) y recursivo, mince, tengo mucho de node, el padre de child1_1 es child1

 {parent: {parent: {innerHTML: '#first-post'}, innerHTML: '#1-reply'}, innerHTML: '#1-reply-1'}

Gracias por adelantado.

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!