tags:

views:

2247

answers:

1

Hello All,

I have an Asynch loaded tree that I am trying to have certain branches expanded when a user does a search. Now I have the data coming back from the server side, but how do I expand (and load if necessary) a specific node of a tree by the value (i don't have the node id) Is there anyway to lookup the node by value?

Thanks

A: 

I think you'd have to ask the server to send you the branch(es) containing the value(s) needed, as well as all the branches from the root to the leaf. You could then iterate through the result from the server, adding the branches where they do not already exist.

Once you have created the tree there is a function to ensure that the leaf and parent nodes are all visible, ensureVisible().

Searching for results within the tree you can use the findChild() function (probably in a recursive function) to see whether you already have the value in the tree, otherwise you need to ask the server to find it for you.

Allan