Select / Deselect all nodes

Hello.



I have an object of dhtmlXTreeObject and I added some items using insertNewItem function. Each item in the tree is a checkbox.



Is there an efficient way to select and deselect all items of the tree, using a button/link/etc??



Thank you very much!

To unselect all items
    tree.clearSelection();

There is no built in functionality to select all items, but you can use next code snippet

    tree.clearSelection();
    for (var id in tree._idpull)
       if (typeof(val)==“object”)
          tree.selectItem(id,true,true);