[Users] Treepanel node search?

Robert Buckley robertdbuckley at yahoo.com
Wed Mar 14 10:12:45 CET 2012


Hi,

Thanks for the code.

I have a treepanel which has (or will have) over 100 layers. In order that the user can find a layer quicker I wanted to develop I little search tool which will iterate through the treepanel looking for the search string and match it with the treenode.text (name of the layer). When matches are found these should be listed so that the user can click on one of the results, open the parent and display the layer.

Quite a tall order.

yours,

Rob



________________________________
 Von: "Peter.Jehle at tba.llv.li" <Peter.Jehle at tba.llv.li>
An: robertdbuckley at yahoo.com 
Gesendet: 9:57 Mittwoch, 14.März 2012
Betreff: AW: [Users] Treepanel node search?
 

 
Hi Robert
I'm not sure, what you are looking for. Probably your are looking for something else, but I post some code that I use to crawl trough a tree an do something with the leaves. Maybe it will help you
Regards
Peter
 
var rootNode=layerTree.getRootNode();
rootNode.eachChild(function (myNode) {
   myNode.collapse(); 
   myNode.eachChild(function (n) { 
                      for (i=0; i < n.layer.params.LAYERS.length; i++) {
                         if (n.layer.params.LAYERS[i] == n.text ) {
                              n.setText( 'test');
                         }
                  } 
                  n.disable();
   });
});
 
 
 
Von:users-bounces at geoext.org [mailto:users-bounces at geoext.org] Im Auftrag von Robert Buckley
Gesendet: Mittwoch, 14. März 2012 08:44
An: users at geoext.org
Betreff: [Users] Treepanel node search?
 
Hi,
 
Has anyone developed a simple treepanel search which iterates through a treepanel and finds the node.text?
 
I can iterate through, but am not sure how to get the results to do anything usefull....ie..if 5 results are found, it would be necessary to then either open parent container , switch visibility to true and zoom to extent for the selected node.
 
Any help would be great,
 
cheers,
 
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120314/9d133ebe/attachment.htm 


More information about the Users mailing list