Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Bill Jindrich on Jul 21, 2008 08:56
open dhtmlx forum
dhtmlXtree: any way to have findItem() not search the HTML of a tree item?

We use HTML <a> elements as the text for each item to hold the URL to each item on our web site. For example:
<item text="<a href='<url to page>/page1.html?id=123'>Page 1 title</a>"
...

What we are seeing with findItem() is that it searches all text in the text attribute of the <item> element, including the URL. So, for example, if we have a page with a title "HTML", and we use findItem() to find this page in the tree, every item in our tree will match, because every page has HTML in the URL (for example: .../test1.HTML).

Is there any way to have findItem() only search the text and not the URL of the tree items?
Answer posted by Support on Jul 22, 2008 03:54
>>Is there any way to have findItem() only search the text and not the URL of the tree items?
It will requrie complex modification to source code.
The find item functionality converts entered text into regexp, which will be used in search
dhtmlxtree.js line 3971
   searchStr =  new RegExp(searchStr.replace(/([\?\*\+\\\[\]\(\)]{1})/gi,"\\$1").replace(/ /gi,".*"),"gi");
you can modify this code to your requirements

The more simple solution is to use just text part of link inside text attribute and use onClick event of tree to change page location instead of inline links