TreeView with checkboxes: Initial value for parent nodes

1 Answer 62 Views
TreeView
Rayko
Top achievements
Rank 1
Iron
Iron
Iron
Rayko asked on 18 Jul 2024, 08:04 AM

Hi,

I have a TreeView where the initial values are set programmatically.

When all the child nodes are checked the parent node should be checked as well. But it isn't:
https://blazorrepl.telerik.com/GIOLlWks03IKIiiZ31

Is there any solution for that?

 

Best regards,

Rayko

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 19 Jul 2024, 06:31 AM

Hello Rayko,

CheckParents="@true" and CheckChildren="@true" define how the TreeView reacts to user behavior. When checking and unchecking items programmatically, you need to handle all parents and children explicitly.

Regards,
Dimo
Progress Telerik

Do you have a stake in the designеr-developer collaboration process? If so, take our survey to share your perspective and become part of this global research. You’ll be among the first to know once the results are out.
-> Start The State of Designer-Developer Collaboration Survey 2024

Rayko
Top achievements
Rank 1
Iron
Iron
Iron
commented on 19 Jul 2024, 06:45 AM

Hi Dimo,

but why is the parent set to intermediate state once one ore more children are not checked? There it is set automatically.

So I thought it should be also handled for the other states as well.

 

Best regards,

Rayko

Dimo
Telerik team
commented on 19 Jul 2024, 06:56 AM

The indeterminate state is only a visual indication for the user. Indeterminate items are not present in @bind-CheckedItems="@SelectedItems".

There are two reasons why we don't check and uncheck items automatically during programmatic operations:

  • In this way we give full control and more flexibility to the app and the developer. If we managed the checked items automatically in this case, this may be limiting to you.
  • It is a general best practice for UI components not to interfere or override programmatic operations on them.
Tags
TreeView
Asked by
Rayko
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or