kendo-react icon indicating copy to clipboard operation
kendo-react copied to clipboard

Enhance TreeList Selection with Parent-Child Checkbox Propagation

Open Nassefferjeni opened this issue 10 months ago • 4 comments

Currently, KendoReact TreeList doesn't offer a built-in way to achieve selection behavior where selecting a parent node automatically selects all its children, and vice versa (deselecting all children deselects the parent). This feature would be highly beneficial for use cases involving hierarchical data structures where managing parent-child selection is crucial.

Question Do we have a logic in place for this? ( even if the logic is custom )

If not:

Here's a proposed approach:

  • Introduce a new option for the selectable prop, potentially named propagateSelection or recursiveSelection (similar to applyCheckIndeterminate provided in the TreeView component ). When set to true, it activates the desired behavior where selecting a parent selects all children, and deselecting all children deselects the parent.

Benefits:

  • Simplifies selection logic for developers working with hierarchical data.
  • Improves user experience by making parent-child selection intuitive.
  • Reduces the need for custom selection logic implementations.

Nassefferjeni avatar Apr 15 '24 13:04 Nassefferjeni

Hi @Nassefferjeni,

Thanks for the proposed Feature Request.

Firstly, i want to say that, Ive created a StackBlitz demo to demonstrate how to implement the desire behaviour. You can see the main logic which is in the includeChildSelection method:

https://stackblitz.com/edit/react-cyjuac?file=app%2Fmain.tsx

I've also opened a feature request in our FeedBack portal where we track the demand for features. Also, I've upvoted from your behalf:

https://feedback.telerik.com/kendo-react-ui/1649047-parent-child-checkbox-propagation

PaskalevStoyan avatar Apr 17 '24 13:04 PaskalevStoyan

Thank you @PaskalevStoyan for the demo and also the feature request.

But I still think the demo is missing one thing: when you select all of the children of a node the parent should autamtically be selected also.

Nassefferjeni avatar Apr 17 '24 15:04 Nassefferjeni

Hi, @Nassefferjeni,

Thanks for the feedback.

The idea around this demo is to lay grounds for a starting point where it would help people who will come in the future to see this issue. As this is still not a built-in feature and it's quite specific which transforms in a lot of scenarios, it will need the developers' effort to adjust the desired scenario to its needs.

What I mean here is that some will want to check a parent if all of its direct children and all their children are selected, some people will want to leave out the parent out of the selection when all of its children below are selected.

We recommend if there are any questions regarding our components or their specific configuration to submit a support ticket on our support platform.

PaskalevStoyan avatar Apr 18 '24 08:04 PaskalevStoyan

Yes makes sense then.

Thank you @PaskalevStoyan for the effort.

Nassefferjeni avatar Apr 22 '24 13:04 Nassefferjeni