getSelectedItemId returns nothing

hi,

i’m using dhtmlxtree pro and build the tree using:



vTree.loadXML

( “f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:APPLICATION_PROCESS=getVaterTeilnehmerbaum”

, function()

{

vTree.focusItem(vTree.getSelectedItemId());

}

);





As you can see i would like to set the focus on the selected node (there is one node/item in XML marked with select=“1”), but getSelectedItemId returns just a null value.



Is this the wrong place to call this function?



any ideas on how i could fix it or work around?



thanks,



Peter


Hello,


probably you use Smart XML Parsing feature.


In case of using this feature xml isn’t parsed completely.


So, tree doesn’t know about select attribute after xml loading.


What we can recommend ? You can try to set userdata with selected id to the root node and then to select it using tree API. For example:


-xml



ab







-script



tree.loadXML(“tree.xml”,function(){
var selected=tree.getUserData(0,“selected”)
tree.selectItem(selected);
tree.focusItem(selected);
});