Catch after refresh finishes event

Hello, I’m having troubles trying to order a subitems nodes.

I found out how order them when I expand the node, but when I add a new node I can’t figure out how.

The code goes like this
tree.refreshItem(nodeId);
tree.sortTree(nodeId);

The problem is that the first method start running, and goes to the second, so the second finishes and the first one isn’t finished yet. So, when the node expands again, after refreshing, the subitems aren’t ordered.

Is there a way to make sure the sortTree method will run after the refreshItem is finished?

Thanks!!

Hello
Refresh of the tree occurs on the server, that is why you need to try onXLE event handler:

tree.attachEvent("onXLE", function(tree,id){ tree.sortTree(id); });

Thanks!! This works!!

You are welcome!