tree.selectItem() getting deselected after firing th

I’m using selectItem() to reselect the parent node of a tree after removing a child node. This happens (I can see the parent node get selected for a brief instant). This fires off a refresh on another dhtmlx panel and when this happens, I lose the selection on the tree node. Is there a way to prevent this from happening?

What exactly do you do, when the tree loses selection?
If you refresh a page, use the following approach:

tree.enableAutoSavingSelected(true); tree.loadXML("../common/tree.xml",function(){ //tree.loadOpenStates() //if you will need it tree.restoreSelectedItem(); })