org-chart icon indicating copy to clipboard operation
org-chart copied to clipboard

Is it possible to select a node

Open 0xliberator opened this issue 1 year ago • 3 comments

Looking at the futuristic layout, I would like to be able to select an arbitrary node by clicking on it. I will use the reference of the selected node to populate a view in another panel on my page, with additional retrieved data. Is this possible using the currently available features?

0xliberator avatar Dec 06 '23 01:12 0xliberator

Yes, it's possible, within nodeUpdate method add a click event and in the handler change the appearance of the clicked node (and restore all others).

bumbeishvili avatar Dec 06 '23 10:12 bumbeishvili

@bumbeishvili I am new to using your d3-org-chart and i'm quite puzzled as to how to achieve my four requirements with this module, Please help me out. My requirements are

  • Rendering a component as nodeContent that uses global theme

  • Expanding the node to show some more content when i click it

  • showing the 3 levels instead of 2 (default depth)

  • multiple filtering options, (Eg: if filter is selected by department, then all the nodes corresponding to that department must be highlighted @TildeWill @michael-lumley @robert-fink @0xliberator Any help from anyone is highly appreciable

Supritha0203 avatar Dec 07 '23 01:12 Supritha0203

  1. Not exactly sure what you mean by global theme. I assume it's global css. Applying global css can happen automatically but it won't work if you want to export the image, I'd suggest doing everything as an inline style in node content
  2. You need to add click listener in your nodeContent (or attach it in nodeUpdate), then calculate expanded content height, supply new nodeHeight, rerender chart and have a condition either in nodeContent or in nodeUpdate which will show additional content
  3. probably by setting initialExpandLevel not sure if it will work though
  4. You can check out how search works here and I expect you to easily able to modify it so that it matches your requirement

bumbeishvili avatar Dec 07 '23 13:12 bumbeishvili