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

Show counts of items under a node

3 Answers 181 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gregor
Top achievements
Rank 1
Gregor asked on 21 May 2012, 08:09 PM
Is there a way to show the number of items in a parent node, as well as the number of child nodes under each sibling?

3 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 23 May 2012, 08:47 AM
Hello Gregor,

You can use the treeview templates and get the items count through item.items.length:

#= item.text #
# if (item.items) { #
    (#= item.items.length #)
# } #

All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jose
Top achievements
Rank 1
answered on 30 Apr 2015, 07:53 AM

#= item.text #
# if (item.items) { #
    (#= item.items.length #)
# } # 

 Does not return number of items.. It returns (0)

0
Alex Gyoshev
Telerik team
answered on 05 May 2015, 10:24 AM

Hello Jose,

I am afraid that this approach has not been relevant for quite some time. You can calculate the children count in the dataBound event, as shown in this Dojo snippet.

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