Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Feb 13, 2007 15:17
open dhtmlx forum
I am using the tree to display a set of search results. Because of this, some items are repeated in the ...

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?
Answer posted on Feb 13, 2007 15:21

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:

  <item child="0" text="Circulatory" id="9_s" im0="book_titel.gif" im1="book_titel.gif" im2="book_titel.gif"/>

  <item child="0" text="Digestive" id="13_s" im0="book_titel.gif" im1="book_titel.gif" im2="book_titel.gif"/>

instead of

   <item child="0" text="Circulatory" id="9" im0="book_titel.gif" im1="book_titel.gif" im2="book_titel.gif"/>

   <item child="0" text="Digestive" id="13" im0="book_titel.gif" im1="book_titel.gif" im2="book_titel.gif"/>

 
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";

Answer posted by Embre (Support) on Nov 29, 2014 04:14

The information connected with html grid table and agenda events also can help you, so please check it too.