Show counts of items under a node

4 posts, 1 answers
  1. Gregor
    Gregor avatar
    17 posts
    Member since:
    May 2012

    Posted 21 May 2012 Link to this post

    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?
  2. Answer
    Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 23 May 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Jose
    Jose avatar
    1 posts
    Member since:
    Feb 2015

    Posted 30 Apr 2015 in reply to Alex Gyoshev Link to this post

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

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

  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 05 May 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready