<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>Hi,</span></div><div><span><br></span></div><div><span>Thanks for the code.</span></div><div><span><br></span></div><div><span>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.</span></div><div><br></div><div>Quite a tall order.</div><div><br></div><div>yours,</div><div><br></div><div>Rob</div><div><span><br></span></div><div><br></div> <div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "> <div style="font-size: 12pt; font-family: 'times new roman',
'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">Von:</span></b> "Peter.Jehle@tba.llv.li" <Peter.Jehle@tba.llv.li><br> <b><span style="font-weight: bold;">An:</span></b> robertdbuckley@yahoo.com <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 9:57 Mittwoch, 14.März 2012<br> <b><span style="font-weight: bold;">Betreff:</span></b> AW: [Users] Treepanel node search?<br> </font> </div> <br><div id="yiv776002135">
<style><!--
#yiv776002135
_filtered #yiv776002135 {font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv776002135 {font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
#yiv776002135
#yiv776002135 p.yiv776002135MsoNormal, #yiv776002135 li.yiv776002135MsoNormal, #yiv776002135 div.yiv776002135MsoNormal
        {margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"serif";}
#yiv776002135 a:link, #yiv776002135 span.yiv776002135MsoHyperlink
        {
color:blue;
text-decoration:underline;}
#yiv776002135 a:visited, #yiv776002135 span.yiv776002135MsoHyperlinkFollowed
        {
color:purple;
text-decoration:underline;}
#yiv776002135 span.yiv776002135E-MailFormatvorlage17
        {
font-family:"sans-serif";
color:#1F497D;}
#yiv776002135 .yiv776002135MsoChpDefault
        {
font-size:10.0pt;}
_filtered #yiv776002135 {
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
#yiv776002135 div.yiv776002135WordSection1
        {}
--></style>
<div>
<div class="yiv776002135WordSection1">
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">Hi Robert</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">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</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">Regards</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">Peter</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> </span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">var rootNode=layerTree.getRootNode();</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">rootNode.eachChild(function (myNode) {</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> myNode.collapse();
</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> myNode.eachChild(function (n) {
</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> for (i=0; i < n.layer.params.LAYERS.length; i++) {</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> if (n.layer.params.LAYERS[i] == n.text ) {</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> n.setText( 'test');</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> }</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> }
</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> n.disable();</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> });</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;">});</span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> </span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> </span></div>
<div class="yiv776002135MsoNormal"><span style="font-size:11.0pt;color:#1F497D;"> </span></div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;"><b><span lang="DE" style="font-size:10.0pt;">Von:</span></b><span lang="DE" style="font-size:10.0pt;"> users-bounces@geoext.org [mailto:users-bounces@geoext.org]
<b>Im Auftrag von </b>Robert Buckley<br>
<b>Gesendet:</b> Mittwoch, 14. März 2012 08:44<br>
<b>An:</b> users@geoext.org<br>
<b>Betreff:</b> [Users] Treepanel node search?</span></div>
</div>
</div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;"> </div>
<div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;">Hi,</span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;"> </span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;">Has anyone developed a simple treepanel search which iterates through a treepanel and finds the node.text?</span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;"> </span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;">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.</span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;"> </span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;">Any help would be great,</span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;"> </span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;">cheers,</span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;"> </span></div>
</div>
<div>
<div class="yiv776002135MsoNormal" style="margin-left:35.4pt;background:white;"><span style="font-size:10.0pt;color:black;">Rob</span></div>
</div>
</div>
</div>
</div>
</div><br><br> </div> </div> </div></body></html>