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

Treeview Folder or Node Item Count

1 Answer 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chummy
Top achievements
Rank 1
Chummy asked on 23 Jan 2012, 07:53 PM
Hi, how do I get an item count for a treeview folder or node? I would like the item count to appear in parenthesis () next to the folder or node.

Thanks
Gary

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Jan 2012, 06:11 AM
Hello,

Try the following.
JS:
function OnClientLoad(sender, args)
   {
     var nodes = sender.get_allNodes();
     for (var i = 0; i < nodes.length; i++)
     {
      if (nodes[i]._hasChildren() == true)
       {
         var cnt = nodes[i]._children.get_count();
         var nodetxt = nodes[i].get_text();
         var txt=(nodetxt +"("+cnt+")" );
         nodes[i].set_text(txt);      
        }
     }
   }

Thanks,
Princy.
Tags
TreeView
Asked by
Chummy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or