Hello,
I want to have a tree component with checkboxes with it. but I cant figure it out how to implement this.
is it even possible?
Checkboxes are not supported for the tree component.
thank you for your quick response
On further reflection, there are additional features; such as selecting a root node and having all the child nodes selected, or selecting a child node and seeing an indicator on the parent nodes, that may make this more difficult than simply adding a check box.
@kamikg - I wrote an article, with code, here: Blazor Tree Creator with Checkboxes (blazorhelpwebsite.com)
@korchev - Perfect Is there a way to turn off "cascading checkboxes" (automatically selecting the checkboxes of the child nodes)? - Thanks!
@korchev - Also, on the example page, can you (1) indicate how a person would programatically determine what boxes were checked by the user and (2) how to programatically select check boxes. - - There are the challenges I ran into. Thanks!
Hey @ADefWebserver,
You can use AllowCheckChildren and AllowCheckParents to turn on/off if children/parents should be affected. You can use @bind-CheckedValues to get/set checked nodes.
@enchev - Regarding using use @bind-CheckedValues to set checked nodes. If I set a root folder it will set properly:
But, If I set only child nodes it wont:
A sample project is attached: RadzenTagCreator.zip (405.5 KB)
Thank You!
Hi @ADefWebserver,
Indeed at the moment if AllowCheckChildren is set to true and some child node values are added to CheckedValue without parent node value they will be unchecked on expand. You will need to either add the parent node value to CheckedValues or set AllowCheckChildren to false. Here is how it looks if AllowCheckChildren is set to false:
@enchev - Yes that works thank you.
However, when I have AllowCheckChildren set to false, I am unable to freely check, and uncheck, all the nodes.