Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Terry on Jun 11, 2009 11:26
open dhtmlx forum
Unable to get focusItem() to work

Hi there --

I have the pro version and am trying to use focusItem()

I load in my notes from XML, and all itemIDs are numbers. (ex: id="10", etc).

I am trying to focus on item ID "10".

The following, however, doesn't do anything at all:

tree.selectItem("10");
tree.focusItem("10");

Any suggestions?

Thx
Answer posted by Alex (support) on Jun 12, 2009 02:11

Hello,

please check that these methods are called after xml loading and item with id=10 is presented in the loaded xml:

tree.loadXML("some.xml",doAfterXMLLoading);

function doAfterXMLLoading(){

tree.selectItem("10"); 
tree.focusItem("10");

}

Answer posted by Terry on Jun 12, 2009 07:42
Thanks, that was the problem.  The focusItem() was being called before the XML fully rendered the tree.