Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by kerri on Jun 04, 2009 14:20
open dhtmlx forum
openItem after refresh

Hi,
How do I open a node after a refresh? I've tried a couple of ways to write this code with no luck:

function updateTree(nodeId) {
tree.refreshItem(0);
tree.openItem(nodeId);
}

function updateTree(nodeId) {
tree.refreshItem(0, function() {tree.openItem(nodeId);});
}

I get the tree refreshed but the node does not open...I've also tried openItemsDynamic and openAllItems in both cases. Any suggestions?

Thank you
Answer posted by Alex (support) on Jun 05, 2009 00:44
There are smartRefreshItem and smartRefreshBranch methods that preserve open state  of the tree.
But if you want to use refreshItem and openItem manually. You can use onXLE event handler. This event is called after xml loading:

evList = tree.attachEvent("onXLE",function(){
    tree.detachEvent(evList)
    tree.openItemsDynamic(list_of_ids);
})
tree.refreshItem(0);