selectItem of the preselectd Item

I have enableSmartXMLParsing(true) set in my tree.

I need to focus/open the preselected item when user clicks on my form input (that displays tree)

I am passing the preselected items id as part of the XMLString returned from the servlet as userdata of one ID.

if I see

tree.selectItem(“551”) pass the id directly it works

but I need to retrieve 551 from another node (nodeid “1” always") userdata and open. I am not able to do that. I am doing shown below

tree.loadXML(“/mgmt-mbean-allowed-values?mbeanName=”+mbean+“&attributeName=”+param+“&default=”+value+“&operation=false”);
tree.selectItem(“1”);
var id = tree.getUserData(“1”, “preselectedId”);
alert("the preselect id is "+id);
tree.selectItem(id);
//tree.selectItem(“551”);-----------> this works. I am trying to retrieve this from nodeid “1” userdata…

loadXML loads data asynchronously. For this reason, you need to call “selection” code from loading end handler:

tree.loadXML("/mgmt-mbean-allowed-values?mbeanName="+mbean+"&attributeName="+param+"&default="+value+"&operation=false",doAfterLoading);

function doAfterLoading(){
tree.selectItem(“1”);
var id = tree.getUserData(“1”, “preselectedId”);
alert("the preselect id is "+id);
tree.selectItem(id);
}

I tried using init callback also. I does not work. My xml looks right and tree is working right. But not able to select the preselected item on init.

Locally the following approach shows and highlights an item that is located in any level even if SmartXMLParsing is used:

tree.loadXML(url,function(){
tree.selectItem(itemId);
tree.focusItem(itemId);
});

if the problem still occurs, please provide the complete demo.

Is it possible to fire something after refreshItem?
See my concern:
viewtopic.php?f=3&t=19760