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

Treeview checked parent node

3 Answers 178 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
blackhawk
Top achievements
Rank 1
blackhawk asked on 18 May 2014, 11:18 AM
Hi, 
I´m trying to use a treeview with checkboxes for definition User Rights. (2 actions - enabled/disabled right)
How can I to get value (id) from parent node ?

I attached an example what I need.

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 May 2014, 07:47 AM
Hello Stano,

Do you need the indeterminate nodes to be treated as checked, or do you need the checked state to be persisted when the child nodes are unchecked? For the first case, the following snippet will get you the IDs of the indeterminate nodes:

var tree = $("#treeview").data("kendoTreeView");
tree.element.find(":checkbox")
    .filter(function() { return this.indeterminate; })
    .map(function() { return tree.dataItem(this).id; });


For the second case, here is a Dojo snippet that shows this.

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
blackhawk
Top achievements
Rank 1
answered on 19 May 2014, 10:22 AM
thx for answer, I need the checked state to be perists when the child nodes are unchecked.
Thanks for example but still is not ok.
 I need checked all parent nodes when I checked QUX in tree. I need combination original demo example with this example what do you sent

When I checked Parent nodes  I need automatically checked Children.
When I checked Child nodes I need automatically checked Parents.
When I have checked all children and i unchecked one of the children a I need the checked state of parent nodes for this children to be persist.







0
Alex Gyoshev
Telerik team
answered on 19 May 2014, 11:39 AM
Hello Stano,

This functionality is not supported out of the box. The provided code snippet allows you to gather the indeterminate checkboxes and get the IDs of their data items, so you can process them as necessary.

Regards,
Alex Gyoshev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
blackhawk
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
blackhawk
Top achievements
Rank 1
Share this question
or