notlkk
notlkk

Reputation: 1231

Select Every Node in Kendo TreeView

I have a kendo treeview like this:

sectionTreeView.kendoTreeView({
        dataValueField: "Id",
        dataTextField: "Name",
        checkboxes: {
            checkChildren: true
        }
});

I use the following code to programmatically select the root node:

divTreeView.getKendoTreeView().select(".k-item:first");

However, the first node is only highlighted but its checkbox remains unchecked and so is every child node below it. How do I make every checkbox checked?

Upvotes: 0

Views: 2375

Answers (2)

Hemant Sarraf
Hemant Sarraf

Reputation: 1

$("#accountsTree .k-item input[type=checkbox]").attr('checked', 'checked');

Upvotes: 0

boniestlawyer
boniestlawyer

Reputation: 707

Try checking the checkbox after you have selected the node like this:

var treeView = divTreeView.getKendoTreeView();
// you need to select the node for this to work
treeView.select(".k-item:first");
treeView.select().find(".k-checkbox input").prop("checked", true).change();

Upvotes: 1

Related Questions