openItem after refresh

Hi,

How do I open a node after a refresh? I’ve tried a couple of ways to write this code with no luck:



function updateTree(nodeId) {

tree.refreshItem(0);

tree.openItem(nodeId);

}



function updateTree(nodeId) {

tree.refreshItem(0, function() {tree.openItem(nodeId);});

}



I get the tree refreshed but the node does not open…I’ve also tried openItemsDynamic and openAllItems in both cases. Any suggestions?



Thank you

There are smartRefreshItem and smartRefreshBranch methods that preserve open state  of the tree.
But if you want to use refreshItem and openItem manually. You can use onXLE event handler. This event is called after xml loading:

evList = tree.attachEvent(“onXLE”,function(){
    tree.detachEvent(evList)
    tree.openItemsDynamic(list_of_ids);
})
tree.refreshItem(0);