bkrem / react-d3-tree

:deciduous_tree: React component to create interactive D3 tree graphs
https://bkrem.github.io/react-d3-tree
MIT License
1.07k stars 270 forks source link

Access individual nodes via refs #169

Open mwilde345 opened 5 years ago

mwilde345 commented 5 years ago

Thank you for taking the time to report an issue with react-d3-tree!

Feel free to delete any questions that do not apply.

Are you reporting a bug, or opening a feature request?

feature request

What is the actual behavior/output?

Clicking on a node exposes the nodeData object .

What is the behavior/output you expect?

I also want to access the Node (preferably the actual node, not the label) as a DOMElement, to get properties like its position. For example, when giving a node it's uuid, can you also give it that value as the ref? Within the click event I can get the nodeData, and thus the id. It'd be nice to do this.refs[uuid].

What version of react-d3-tree are you using?

latest

bkrem commented 5 years ago

Thanks for this proposal @mwilde345, I agree that this should be possible, scheduling it for the next minor version bump of v1.x or for v2.1.