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

Checkbox when selecting node

1 Answer 44 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
OfficeHeart
Top achievements
Rank 1
OfficeHeart asked on 28 Jan 2014, 11:01 AM
Hello,

I like the checkbox functionality in the treeview. Is it possible to check the checkbox when selecting a node and behave the CheckChildren.

Thanks,
Martin

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 28 Jan 2014, 12:06 PM
Hello Martin,

You can set the checked field of the dataItem and it will trigger the checkChildren functionality. Here is the code that checks the nodes whenever an item is selected:

$("[data-role=treeview]").data("kendoTreeView")
    .bind("select", function(e) {
        var dataItem = this.dataItem(e.node);
        dataItem.set("checked", true);
    });

Regards,
Alex Gyoshev
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
OfficeHeart
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or