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

When a parent is checked is it possible to expand all its children nodes #423

Open
bollampallyrohit opened this issue May 1, 2023 · 1 comment
Labels

Comments

@bollampallyrohit
Copy link

Hello,

In our project we want to have a functionality where in when a parent with children is checked then expand all its children. So is it possible to do it

@jakezatecky
Copy link
Owner

There is no property to enable this behavior, but it is possible to code this yourself by setting the state of the expanded property within the onCheck function, by utilizing the second parameter:

const [checked, setChecked] = useState([]);
const [expanded, setExpanded] = useState([]);

function onCheck(checked, node) {
  setChecked(checked);
  setExpanded([...expanded, node.value]);
}

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

No branches or pull requests

2 participants