I have a treeview which currently shows a hierarchy of items that are different at each level. The TreeView is configured to use checkboxes and to check the children whenever the parent is checked. An example (without checkboxes) of the item types is illustrated as follows:
TypeA
TypeB
TypeB
TypeB
TypeC
TypeC
TypeB
TypeA
TypeB
Since the items vary by level, I want to write some javascript that retrieves the corresponding values by level. That is, I want to retrieve the values of all checked items at level 1, or all checked items at level 2, or all checked items for level 3. That said, I modified the code, provided by the example at: http://www.telerik.com/blogs/how-to-get-the-checked-items-from-a-treeview-with-checkboxes which recursively loops through all nodes in the treeview. Basically, the code examines each node and evaluates the 'checked' property to determine if the node has been checked. Unfortunately, the 'checked' property is undefined when only a subset of the descendants are checked. It would be nice if the node had a property indicating that at least one descendant was checked. I know that I can examine the 'hasChildren' property and recursively loop to determine if any descendant is checked, but I'm hoping that someone has a better approach. In lieu of a simple property, what is the most efficient way to determine if a node has any 'checked' descendants?
Thanks.
Mike
.