DhtmlxTree: how to expand all and collapse all with single

DhtmlxTree how to expand all and collapse all with single click

There are next API calls

    tree.openAllItems();
    tree.closeAllItems();