Steps to reproduce:
Expected: Both the parent "Documents" and its 4 children should be checked.
Actual: Only the 4 children are checked; the parent remains unchecked.
This only happens when all children are checked. However, if not all children items are checked, the parent will also be checked.
Hi Matthijs,
Thank you for getting back to me with more information on your situation. Let me shed some more light on the matter below.
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.
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:
Regards,
Hristian Stefanov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Hristian,
Thanks for your response.
This was just an example, in our use case we don't know which of the children were checked. For example, if 3 out of 4 were checked we do see this: (I changed the line to: CheckedItems = Data.Skip(2).Take(3).ToList();)
So documents is now in an "indeterminate state". This is expected, but when all 4 children are selected, the parent should be selected too which isn't the case:
Hi Matthijs,
I’m curious about why you’d want the parent node to be checked on initialization when it was explicitly skipped in the OnInitialized handler. Given that the code is intentionally set to skip that parent, this behavior seems to align with the expected result from this implementation.
I’d appreciate your feedback on this perspective.
Regards,
Hristian Stefanov
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