Is there a function which expands/collapses a tree to a specified level? E.g. myTreeGrid.showNodesToLevel(2) which would only show the tree nodes up to the 3rd level (automically collapsing/expanding as necessary).
Nope, unfortunately there is no such function, but next code can be used for the same task
treegrid._h2.forEachChild(0,function(el){
if (el.level == 1)
treegrid.openItem(el.id);
});