Treeview with Checkboxes in WebAssembly

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.

1 Like

thank you for your quick response

@enchev I was going to give this a try using templates. Is there a reason I should not even try?

@ADefWebserver There should be no problem in my opinion.

1 Like

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.

@ADefWebserver
I couldn't do it and I used js components
if you had any success please share

@kamikg - I wrote an article, with code, here: Blazor Tree Creator with Checkboxes (blazorhelpwebsite.com)

Built-in checkbox support is now available: https://blazor.radzen.com/tree

1 Like

@korchev - Perfect :slight_smile: 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.

1 Like

@korchev - Thanks. I will do another article using just the Radzen control.

@enchev - Regarding using use @bind-CheckedValues to set checked nodes. If I set a root folder it will set properly:

image

But, If I set only child nodes it wont:

image

image

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.

image

Hi @ADefWebserver,

This is definitely bug and it will be fixed immediately!

1 Like

I can confirm it has been fixed in Release 3.6.5 ยท radzenhq/radzen-blazor (github.com)

I posted an updated article with code: Radzen Blazor Tree Creator with Checkboxes

2 Likes

hi ! i m using Radzen Tree Component with Check box .i want to show check box selected when data is saved to database and then load .how i can show as selected box at reload page ?