I am using the tree to display a set of search results. Bec

I am using the tree to
display a set of search results. Because of this, some items are repeated in
the tree. For example, a search might yield an item in the top level, and then
that same item will actually reappear in a lower level because it is really a
child of the one I may have clicked.

Is
there anything that can be done to avoid this behaviour and have the node I
click expand normally as if in a regular tree?

The problem is caused by non unique node ID.
If
you have some nodes with the same ID value, then the result can be
unpredictable, because tree cannot recognize nodes with the same ID.
The
only solution is to use unique ID.

In
your case, you can adjust search routine, so it returns:

 

 

instead
of

  

  

 
In
such case items from search result will have different ID than items from next
levels of tree.

The
server side code which handles dynamical loading, must be also adjusted to
convert complex id “nn_s” back to simple “nn”;