Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide children of previously clicked node when new node is clicked #87

Closed
DianaPilat opened this issue Mar 15, 2018 · 2 comments
Closed

Comments

@DianaPilat
Copy link

Thank for the beautiful plugin! I have a question/feature request. Is it currently possible to hide expanded children of previously clicked node when another node is clicked? I have a horizontal phase/subphase tree with large dataset and want to leave open only the children of the clicked node and have others that were opened before closed. Did not find this feature in documentation. Please let me know.

@bkrem
Copy link
Owner

bkrem commented Mar 27, 2018

Hi @DianaPilat,

Sorry for the delay! This isn't currently a feature but has been requested (#46).

I'll make an effort for this to be in the next feature release since it's been requested by multiple people now including you.

Going to close this issue so we can consolidate the discussion for it in #46.

@bkrem bkrem closed this as completed Mar 27, 2018
@anilramavtar
Copy link

here is the work around solution to achieve this

<Tree data={phaseData} ref="myRef"
initialDepth={1}
orientation="vertical"
pathFunc="elbow"
translate={{ x: 575, y: 20 }}
styles={{ links: { stroke: '#89828D', strokeWidth: 1 } }}
nodeSize={{ x: 160, y: 50 }}
zoomable={false}
onClick={(nodeObj) => this.handleClick(nodeObj, true)}
/>

handleClick(nodeObj, cont) {
if(!cont || nodeObj._collapsed)
return;
const myRef = this.refs.myRef;
const parentObj = nodeObj.parent;
if(parentObj && myRef) {
const nodesToBeCollapsed = parentObj.children.filter(c=> c.id !== nodeObj.id);
nodesToBeCollapsed.map((ndObj,index) => {
if(!ndObj._collapsed)
myRef.handleNodeToggle(ndObj.id, false);
});

}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants