TreeView count child nodes

Hi,



Is there a way to count the number of child nodes for a certain parent node?



Thanks.


Hello,


there is hasChildren method that returns the number of direct child items:


var count = tree.hasChildren(itemId);

Thanks for this Alex.

Is there a function to determine which parent nodes have been selected?

This is so i can loop through them and check how many child nodes for each parent have been selected.

Thank you.


Hello,


There are following method that return ids of checked items:


- getAllChecked() returns the list of all checked items


in case usign 3-state checkboxes the following two methods can be also used:


- getAllPartiallyChecked() -list of partially checked items


- getAllCheckedBranches() - list of checked and partially checked items


If you want to get “checked” state for a certain node, you can use isItemChecked(itemId) method in combination with getSubItems(id) or getAllSubItems(id)