1
votes

I am using Kendo UI tree view with checkboxes. My problem is when i am loading the tree i will be checking some checkboxes using javascript. But this is not selecting parent checkbox automatically. Do i need to do this manually or is there any option in the framework.

Thanks, Raja

3

3 Answers

1
votes

Lets assume that you want to select the node that is selected:

// Get the node that is selected
var selected = treeview.select();
// Find the checkbox associated with this node
var checkbox = $("input[type='checkbox']", selected)[0];
// Click on it for selecting it and its ancestors
checkbox.click();

Being treeview the result of creating kendoTreeView:

var treeview = $("#my_tree").kendoTreeView({...}).data("kendoTreeView");
0
votes

If you check the nodes by adding the 'checked' attribute with JavaScript e.g.

$('input').attr('checked','checked')

you will need to handle the parent checking manually. However if you simulate click the TreeView will update its state as it would do if you have used the mouse to click. e.g.

$('input').click();

Keep in mind you need to call the click on the checkbox input not the span element wrapping it.

0
votes

Kendo ui (html5) treeview the position is reset to the begining of the tree. when i bind the many records in the tree . when i select the last node the treeview position is reset to the begining of the tree. This problem arises only in IE(Internet Explorer 9). in firefox and chrome it is working fine .

The image 1 shows the page that treeview reset to begining of the tree after selecting the tree node at the last record.

image

the image 2 shows the page that treeview node is selected at the botom

image2