bumbeishvili / org-chart

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

event handler for nodes #323

Closed sajjadarashhh closed 1 year ago

sajjadarashhh commented 1 year ago

i have nodes that have many data for view i wana to add a button that when user click on that data showes to user and problem is shown here! when user click on that button node height give changed for example in collapsed height is 125 and in expanded height is 500 how can i update node height in org-chart?

bumbeishvili commented 1 year ago

You have to set a new height (you can calculate new height based on the content, using . getBoundingClientRect function ) and rerender the graph

So

when user clicks the button • Calculate new height of the node based on the new content and save it somewhere, preferably assign the data of the node itself, call it expandedHeight or something • rerender the graph and provide new height in the following way: chart.nodeHeight(d=>d.expandedHeight?d.expandedHeight:defaultHeight).render()

sajjadarashhh commented 1 year ago

Thank you for response