Hi all,

I am using the TreeView within my project but wondering what the best method is for the following:

- If a parent node is selected (and all the child nodes for that parent) i need to return the parent id only.

- If a some but not all child nodes are selected i need to return those individual child IDs instead of the Parent ID.

Is this possible with the current API or would i need to tweak this slightly?

Thanks very much, Great product!


do you use 3-state checkboxes ?

if yes, you can use the following approach

function getChecked(id){
var state = tree.isItemChecked(itemId)
if(state==1) return id;
if(state ==2){
var arr = [];
var ids = tree.getAllSubItems(id).split(",");
for(var i=0; i < ids.length;i++){
return arr

if you don’t use 3-state checkboxes, you can can use getAllSubItems(id) method in combination with isItemChecked method to get the necessary result.


Yes i am using a 3-state checkbox so that works perfectly.

Is there a method of knowing if the value returned is the id of a parent or child node?

Thank you.


there is hasChildren(itemId) method that returns the number of child nodes. So, it returns 0 for leaves and positive number for folders.