dhtmlxTree: save search in tree

Good afternoon,



I tried to create something like your file-explorer, including tree and normal grid. loading my directories and the files works great.



Now I tried to implement a search function with an input field:

looking for any file in all directories like the search string. My first problem: I need to look at the “content-xml”, look for the text and if I find any file, I need the correct id of the directory and save both to show my results.

The results should be shown like this:



=====================

+dir1

+dir2

+Search

|

±my search string 1

±my search string 2

=====================



Clicking on one of those “new directories” shows my results in the grid. How can I save these “dynamic search strings”? I read something about saving the tree in a cookie with the pro version?

Maybe I should save 4 or 5 of the strings in a seperate xml-file, loading it after my directory-xml.



Any other ideas?



MfG


Hello,


>> My first problem: I need to look at the “content-xml”, look for the text and if I find any file, I need the correct id of the directory and save both to show my results.


you can use findItem method of the tree (PRO edition only). It search item also in the xml and returns its id. Then you can get item label by id: var text = tree.getItemText(itemId)


>> How can I save these “dynamic search strings”? I read something about saving the tree in a cookie with the pro version?


You can use insertNewChild method to add items with search results.


In order to save the whole tree structure in cookie you can use saveState method. But cookie size is limited, so if tree isn’t small, you can’t use this method.


Possibly it is better to save in cookie only search results ( not the xml structure ).