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

2 posts, 0 answers
  1. Bill
    Bill avatar
    7 posts
    Member since:
    Jun 2013

    Posted 28 Nov 2013 Link to this post

    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?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 02 Dec 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top