jakezatecky / react-checkbox-tree

A simple and elegant checkbox tree for React.

Home Page:https://jakezatecky.github.io/react-checkbox-tree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Is possible noCascade only downward?

SergioArrighi opened this issue · comments

Hello and thanks for the nice work,
I'm sorry to post a question but it seems I cannot figure it out.
I would like children node not to be checked when parent is checked but I'd need the parent to be checked when a child is checked.
I tried the noCascade option but it only works two ways.
Is there a way to achieve the needed behavior?
Thanks in advance and best regards

Unfortunately, this is not currently possible with the existing properties. As you note, the closet thing to what you request, noCascade, goes both ways. This is a potential future enhancement, but it would be a bit lower on the priority.

With what is available, you could hypothetically enable noCascade and watch the onCheck event, which supplies the target node as the second parameter, and add that node's parent to the checked array if it fulfills your conditions.

Hello and thanks for prompt reply.
All clear, I will try adding some custom logic to my simple onCheck as you suggested.
Thanks for your time!