ErikGartner / dTree

A library for visualizing data trees with multiple parents, such as family trees. Built on top of D3.
https://treehouse.gartner.io/ErikGartner/58e58be650453b6d49d7
MIT License
509 stars 135 forks source link

Onclicking the node change its class #147

Closed mpsbhat closed 1 year ago

mpsbhat commented 1 year ago

Namaste, Is there any simple way to change the class of the node on clicking on it, maybe for highlighting the clicked node.

Thanks in advance!

ErikGartner commented 1 year ago

Hi,

You can make your own callback for when the user clicks the node (using nodeClick). In the javascript you can for example add / change the class of the node to enable highlighting.

Best

mpsbhat commented 1 year ago

Understood. I should use something like document.getElementById(nodeid).className = "classname"; inside nodeClick callback.

Thank you for the suggestion @ErikGartner!