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

How to change cascading behaviour?

Shivraj97 opened this issue · comments

Hi Jack, I want to implement a users dropdown. Each users have certain deals which I need to display. However the cascading behavior is not per my requirement. Clicking on the parent node selects/deselects all the child nodes which is fine and when the child node is deselected then parent node also gets deselected(if that parent have only one child). I don't want this to happen even if the parent has only one child deselecting the child should not deselect the parent because that parent has its own deals which I want to display in UI. Example: Clicking on Bala selects all its child nodes(as expected)

image

and deselecting it deselects all its child nodes(as expected)

image

but selecting/deselecting Beil should selects/deselects all its children(i.e Jairam, Laxman, etc) but should not select or deselect its parent node i.e Bala. There is one prop called noCascade which stops the cascading behavior which I can't use. I need cascading but it should be only one way i.e on children(towards downward) and not parent(towards upward).
Is there any mechanism to achieve what I want currently. Basically I don't want any half or intermediate check for a node.

image

At the moment, the component does not support the behavior you are describing. There is an option to disable the cascading behavior from the parent level, but your desire to disable it when all children all selected/deselected is not quite supported yet.