This is a migrated thread and some comments may be shown as answers.

Treeview checkboxes - Don't deselect parent when all child nodes are deselected

1 Answer 94 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 28 Nov 2013, 08:28 AM
Hi

Is it possible to configure the Treeview checkboxes so that when a node's children are all deselected, the node is not deselected also? I need the CheckChildren functionality turned on so that children are automatically selected when their parent is. But I don't want the parent removed from the selection when its children are unchecked.

To illustrate I have set up a jsbin . I'd like to be able to select nodes a, b1 and b2. However b2 only shows checked when any of c1, c2 and c3 are checked. I can use CheckChildren(false) to allow selection of b1 and b2 individually, but I have much more data than this example so manually checking all the nodes would become too much for the user.

Here is how I am currently placing the treeview on the page (Model.Items is a list of TreeViewItemModel instances):

@Html.Kendo().TreeView().Name("treeview").BindTo(Model.Items).ExpandAll(true).Checkboxes(c => c
        .Enabled(true)        
        .CheckChildren(true)
        )

Any thoughts?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 02 Dec 2013, 07:12 AM
Hello Bill,

I am afraid this is not supported. If you do not want the children to be checked/unchecked automatically you have to disable the CheckChildren option. Since you cannot disable only one of the options you can disable CheckChildren and implement the checking logic manually.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Bill
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or