Searching in a dynamic tree

I have a tree which has dynamic loading.

I also have a textbox in which the user enters some string and presses enter, and based on that string, I search in the tree and focus the item of the tree whose text contains that string.

        tree.findItem($('#myTextBox').val());

This works for trees which don’t have dynamic loading, but for this one it doesn’t work.

Is there some way I can make it work?
Or I need to do it by hand, get all the nodes server-side, save them in a cookie and after that do the finding, opening the parents and focusing?

Yes, you need to use server-side search.

There is openItemsDynamic(list) that opens list of items in dynamic tree - each next item opens after the previous is completely loaded.

So, you can send ajax request with search mask. And server script should return response with id(s) of found item(s) and a list with ids of item parents (for example id_0,id_0_1,id_0_1_3) . In response callback you can call openItemsDynamic method. After all items in list are loaded and open, tree calls onOpenDynamicEnd event. This event can be used to highlighted found item. For example:

function loadItems(list,id){
var h = tree.attachEvent(“onOpenDynamicEnd”,function(){
tree.select(id);
});
tree.openItemsDynamic(list)
}