Tree positioning after successful search

Hi,

i am using the tree with the search function. We have a large list of nodes (~1000) on one level.
is it possible automatically scrolling to the search result (if found).

On the other hand, it seems, that the tree has not found the node iam searched for.

Best regards,
Stefan

Hi,

do you use the findItem() method to search items ?

Could you provide the sample where we can reproduce the problem ?

Hi,

this is my tree setup:

              var itemText;
              tree = new dhtmlXTreeObject("treeboxbox_tree","80%","80%",0);
              tree.setImagePath("../../libraries/dhtmlx/tree/codebase/imgs/");
              tree.setIconSize(0,0);
              tree.enableSmartXMLParsing(true);
              //tree.enableSmartRendering(true);
              tree.setXMLAutoLoading("objects.xml?uname=<%=sy-uname%>");
              tree.setOnLoadingStart(func_a);
              tree.setOnLoadingEnd(func_b);
              tree.enableTreeLines("true");
              tree.setIconSize(0,0);
              tree.loadXML("objects.xml?uname=<%=sy-uname%>");
              function func_a(id,m){
               if(m=="0"){document.getElementById('loader').style.display = 'block';}
               if(m==null){document.getElementById('loader').style.display = 'block';}
              }

Searching will be done via

The tree incrementally loads subsequent nodes.

I have included two pictures: before, after search. As you can see, the item will be found, but
scrolling must be done handy. The number after the names indicate the number of child nodes.

The search function does not have too much benefit, if the user must scroll to the item.

I am using the pro version 2.5

Best regards,
Stefan




Hi,

findItemIdByLabel method doesn’t focus an item. Try to use findItem instead of it:

Hi,

that’s not a solution.

If using your approach, after successful find, the tree processes automatically the onclick method. And the tree doesnt scroll’s to the found item.
A collegue of yours suggested this …byLabel … - method instead

Best regrds,
Stefan

You may try to call focusItem method after selectItem.

If the problem still occurs, you may provide the demo (without tree libraries and server-side scripts) that allows to reproduce the problem locally.