Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Trupti on Jan 08, 2008 22:53
open dhtmlx forum
Highlighting/selecting the node expanded using openItemdynamic(list)

I want to highlight (or select) that node after expanding it and hence i am using the following code snippet:

tree.openItemsDynamic("A,A1");

tree.selectItem("A1");

tree.focusItem("A1");

But this does not highlight the node for me. On debugging inside selectItem('A1') i found that _globalIdStorageFind('A1') method returns null for node A1 and hence it does not result in selection of A1. Due i need to trap some event like "ending of dynamic load" before executing the selectItem() method? The node A1 does appear expanded in the tree but it does not get highlighted how do it get it highlighted?

Answer posted by Support on Jan 09, 2008 03:37
The openItemsDynamic is async event, so instead of calling the command immediately after it - you need to wait operation end. The latest version of tree provides special event onOpenDynamicEnd which occurs when openItemsDynamic operation ends.

tree.attachEvent("onOpenDynamicEnd",function(){
    tree.selectItem("A1");
    tree.focusItem("A1");
})
tree.openItemsDynamic("A,A1");


But if you need just select last item in list you can call command in next way

tree.openItemsDynamic("A,A1",true);

true as second parameter will force last item in list selection