dhtmlxTree, limit selection

Hi. Is it possible to disable selection of certain nodes. What I need is to disable selection of a node, unless it is a leaf.



Thank you,



Orlin

You can try to use onClick event handler. It gets two parameters: clicked id and previous selected item id. So the code can be the following:

tree.attachEvent(“onClick”,function(id,pid){
   
    if(tree.hasChildren(id)>0){

        tree.clearSelection(id);
   
        tree.selectItem(pid);
    
    }

})
If an item is a forder, the previous selected item will be highlighted