Dynamically creating Orgchart | Community
Skip to main content
Adobe Employee
July 30, 2024
Solved

Dynamically creating Orgchart

  • July 30, 2024
  • 1 reply
  • 625 views

Hi there team!

 

I'm trying to build an org-chart component like the following example:

 

 

It needs to allow dynamic insertion of child nodes and multiple levels. I first tried using a composite/nested multifield with a fixed scope, which works as expected. However, when trying to add dynamic logic, the component breaks. I also tried using a recursive approach and a node component recursively, but I could not get the dialog to work (like a carousel). I tried using a Java model and servlet to expose a JSON based on a dam folder. using content fragments, but I'm not getting the desired structure.

 

Has anyone done/seen this before? I would appreciate any guidance. Thank you!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi, 

 

I would suggest breaking this down into components that represent different parts of the structure—such as parent component and child components. Then, use Java to assemble a final representation of what you're aiming to achieve for the frontend. While the multifield approach is simpler from a dialog perspective, it can quickly become cumbersome and messy. This would follow the author experience of components such as the carousel or tabs from the core components. You can check how those work to give you a clear idea:

 

https://experienceleague.adobe.com/en/docs/experience-manager-core-components/using/wcm-components/tabs#edit-dialog 

https://aemlab.blogspot.com/2022/09/aemaacs-core-components-children-editor.html 

 

Hope this helps!

1 reply

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 30, 2024

Hi, 

 

I would suggest breaking this down into components that represent different parts of the structure—such as parent component and child components. Then, use Java to assemble a final representation of what you're aiming to achieve for the frontend. While the multifield approach is simpler from a dialog perspective, it can quickly become cumbersome and messy. This would follow the author experience of components such as the carousel or tabs from the core components. You can check how those work to give you a clear idea:

 

https://experienceleague.adobe.com/en/docs/experience-manager-core-components/using/wcm-components/tabs#edit-dialog 

https://aemlab.blogspot.com/2022/09/aemaacs-core-components-children-editor.html 

 

Hope this helps!

Esteban Bustamante
Adobe Employee
August 1, 2024

Gracias Esteban!

 

I extended the tabs component and made a few changes. Then, I created a servlet to expose the variables of the org chart node as JSON. For the front, I used conditional logic to keep the tabs design in author mode and hide everything in publish mode and handle the renderization of the org chart via custom clientlibs.

 

Thank you for your recommendation!