bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
886 stars 313 forks source link

Hide a node based on a condition #426

Open ganeshpaharan opened 1 month ago

ganeshpaharan commented 1 month ago

Hello Author, Thanks you for your wonderful work & thanks very much for providing a solution for my previous request.

Is there a way to conditionally hide/show a node? I'm working on a feature where expanding a particular node reveals multiple children with the same attributes. I'd like to show just one child node and display the number of similar nodes (essentially hiding the duplicates). I also want this functionality to work when expanding all

Thanks in advance

bumbeishvili commented 1 month ago

Hi, why not precomputing that data before passing it to the org chart and then just showing up that number inside nodes?

I don't see why that logic has to be inside org chart

ganeshpaharan commented 1 month ago

Yes, I did that. I removed duplicate nodes from data then rendered the chart, but it’s not possible to see all the children if I want to since I removed from data Was just looking for any functionality in the chart itself 😊 I can keep original data and load the chart with modified data. And when I want to see all the children while expanding then I’ll have render chart with original data

ganeshpaharan commented 1 month ago

I was wondering if there could be any easy way to implement this 😊

bumbeishvili commented 1 month ago

@ganeshpaharan can you add some kind of rough sketches of what you want, I might not be understanding it fully

ganeshpaharan commented 1 month ago

Sure Below is the example I’m trying to achieve IMG_4973

bumbeishvili commented 1 month ago

@ganeshpaharan can you also link an online sample where you tried my suggestion and faced the problem which you mentioned?

You can extend this sample - https://stackblitz.com/edit/js-mfzkbs?file=index.html