<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18939"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=672533716-01092010>Thanks again, you have been really quite helpful , I
would be traversing confusing examples without your assistance, I
definitely owe ya!</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=672533716-01092010></SPAN></FONT><FONT color=#0000ff size=2
face=Arial></FONT><BR> </DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> users-bounces@geoext.org
[mailto:users-bounces@geoext.org] <B>On Behalf Of </B>Ryan
Williams<BR><B>Sent:</B> September 01, 2010 10:30 AM<BR><B>To:</B>
users@geoext.org<BR><B>Subject:</B> Re: [Users] Question on adding multiple
layercontainer to TreePanel<BR></FONT><BR></DIV>
<DIV></DIV>The way I did it was to first add a
TreeNode:<BR>//<BR> var layerRoot = new
Ext.tree.TreeNode({<BR>
text:
"Layers",<BR>
expanded:
true<BR>
});<BR>//<BR>then add children to that:<BR>//<BR>
layerRoot.appendChild(new
GeoExt.tree.LayerContainer({<BR>
text:
"Overlays",<BR>
map:
mapPanel,<BR>
expanded:
true,<BR>
singleClickExpand:
true,<BR>
loader: {
<BR>
filter: function(record)
{<BR>
var myarr = new
Array();<BR>
myarr[0]=record.get("layer").name.indexOf("Balance");<BR>
myarr[1]=record.get("layer").name.indexOf("Ratio");<BR>
myarr[2]=record.get("layer").name.indexOf("Highlight");<BR>
<BR>
if(myarr[0]==-1 && myarr[1]==-1 &&
myarr[2]==-1){<BR>
return
true;<BR>
}else{<BR>
return
false;<BR>
}<BR>
}<BR>
} <BR>
}));<BR> <BR>//<BR>You can keep appending children by
repeating the above, edited to hold the layers you want. <BR><BR>Then add the
root to the TreePanel with the "root:"
paramater:<BR>//<BR> var tree = new
Ext.tree.TreePanel({<BR>
region:
"west",<BR>
frame:
false,<BR>
title: "Table of
Contents",<BR>
root:
layerRoot,<BR>
enableDD:
true,<BR>
collapsible:
true,<BR>
height:
"60%",<BR>
expanded: true,<BR>
autoScroll:
true<BR>
});<BR><BR>//<BR><BR><BR>Ryan<BR><BR>On 9/1/2010 11:08 AM, Andrew Stewart wrote:
<BLOCKQUOTE cite=mid:94816848A8EB3941B1E8592F425827A96845C804A9@chex2.crdnet.ca
type="cite">
<META name=GENERATOR content="MSHTML 8.00.6001.18939">
<DIV dir=ltr align=left><FONT size=2 face=Arial><SPAN
class=102160316-01092010>Trying to find a good example on how to add multiple
LayerContainers to my TreePanel but so far unsuccesful.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><SPAN class=102160316-01092010><FONT size=2 face=Arial>I've defined two
LayerContainer controls like so -</FONT></SPAN></DIV><!-- Converted from text/rtf format --><FONT
color=#008000 size=2><FONT color=#008000 size=2></FONT></FONT>
<P><FONT color=#008000 size=2><FONT color=#008000
size=2><BR></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>var</FONT></FONT><FONT size=2> layerList_Labels = </FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2>
GeoExt.tree.LayerContainer({<BR>text: </FONT><FONT color=#a31515 size=2><FONT
color=#a31515 size=2>'Labels'</FONT></FONT><FONT size=2>,<BR>layerStore:
mapPanel.layers,<BR>leaf: </FONT><FONT color=#0000ff size=2><FONT
color=#0000ff size=2>false</FONT></FONT><FONT size=2>,<BR>expanded:
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>false</FONT></FONT><FONT size=2>,<BR>loader: <BR>{<BR>filter:
</FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>function</FONT></FONT><FONT size=2>(record) <BR>{<BR></FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>var</FONT></FONT><FONT size=2>
myarr = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>new</FONT></FONT><FONT size=2> Array();<BR>myarr[0] =
record.</FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>get</FONT></FONT><FONT size=2>(</FONT><FONT color=#a31515 size=2><FONT
color=#a31515 size=2>"layer"</FONT></FONT><FONT
size=2>).name.indexOf(</FONT><FONT color=#a31515 size=2><FONT color=#a31515
size=2>"Overview Streets"</FONT></FONT><FONT size=2>);<BR>myarr[1] =
record.</FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>get</FONT></FONT><FONT size=2>(</FONT><FONT color=#a31515 size=2><FONT
color=#a31515 size=2>"layer"</FONT></FONT><FONT
size=2>).name.indexOf(</FONT><FONT color=#a31515 size=2><FONT color=#a31515
size=2>"Quadrant Streets"</FONT></FONT><FONT size=2>);<BR></FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT
size=2>(myarr[0]==-1 && myarr[1]==-1)<BR>{<BR></FONT><FONT
size=2><FONT color=#0000ff><SPAN class=102160316-01092010>r</SPAN>eturn</FONT>
<FONT color=#0000ff><FONT color=#0000ff>false</FONT></FONT>;<BR></FONT><FONT
size=2>}<BR></FONT><FONT color=#0000ff><FONT color=#0000ff><FONT
size=2>else<BR></FONT></FONT></FONT><FONT size=2>{<BR></FONT><FONT
size=2><FONT color=#0000ff><FONT color=#0000ff>return</FONT></FONT> <FONT
color=#0000ff><FONT color=#0000ff>true</FONT></FONT>;<BR></FONT><FONT
size=2>}<BR></FONT><FONT size=2>}<BR></FONT><FONT size=2>}<BR></FONT><FONT
size=2>});</FONT></P>
<P><BR><FONT size=2><FONT color=#0000ff><FONT color=#0000ff>var</FONT></FONT>
layerList_Labels<SPAN class=102160316-01092010>2</SPAN> = <FONT
color=#0000ff><FONT color=#0000ff>new</FONT></FONT>
GeoExt.tree.LayerContainer({<BR>text: <FONT color=#a31515>'Labels<SPAN
class=102160316-01092010>2</SPAN>'</FONT>,<BR>layerStore:
mapPanel.layers,<BR>leaf: <FONT color=#0000ff><FONT
color=#0000ff>false</FONT></FONT>,<BR>expanded: <FONT color=#0000ff><FONT
color=#0000ff>false</FONT></FONT>,<BR>loader: <BR>{<BR>filter: <FONT
color=#0000ff><FONT color=#0000ff>function</FONT></FONT>(record)
<BR>{<BR><FONT color=#0000ff><FONT color=#0000ff>var</FONT></FONT> myarr =
<FONT color=#0000ff><FONT color=#0000ff>new</FONT></FONT> Array();<BR>myarr[0]
= record.<FONT color=#0000ff><FONT color=#0000ff>get</FONT></FONT>(<FONT
color=#a31515><FONT color=#a31515>"layer"</FONT></FONT>).name.indexOf(<FONT
color=#a31515><FONT color=#a31515>"Overview
Streets"</FONT></FONT>);<BR>myarr[1] = record.<FONT color=#0000ff><FONT
color=#0000ff>get</FONT></FONT>(<FONT color=#a31515><FONT
color=#a31515>"layer"</FONT></FONT>).name.indexOf(<FONT color=#a31515><FONT
color=#a31515>"Quadrant Streets"</FONT></FONT>);<BR><FONT color=#0000ff><FONT
color=#0000ff>if</FONT></FONT>(myarr[0]==-1 &&
myarr[1]==-1)<BR>{<BR><FONT color=#0000ff><SPAN
class=102160316-01092010>r</SPAN>eturn</FONT> <FONT color=#0000ff><FONT
color=#0000ff>false</FONT></FONT>;<BR>}<BR></FONT><FONT color=#0000ff><FONT
color=#0000ff><FONT size=2>else<BR></FONT></FONT></FONT><FONT
size=2>{<BR></FONT><FONT size=2><FONT color=#0000ff><FONT
color=#0000ff>return</FONT></FONT> <FONT color=#0000ff><FONT
color=#0000ff>true</FONT></FONT>;<BR></FONT><FONT size=2>}<BR></FONT><FONT
size=2>}<BR></FONT><FONT size=2>}<BR></FONT><FONT size=2>});</FONT></P>
<P><SPAN class=102160316-01092010><FONT color=#0000ff face=Arial>Now I am just
unsure exactly how to add these both to my TreePanel - i've tried adding them
both to root, or trying to use children but it is not showing up. Any help
greatly appreciated.</FONT></SPAN></P><SPAN class=102160316-01092010><FONT
size=2></FONT>
<P><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>var</FONT></FONT><FONT size=2> layerTree = </FONT><FONT color=#0000ff
size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2>
Ext.tree.TreePanel({<BR>title: </FONT><FONT color=#a31515 size=2><FONT
color=#a31515 size=2>''</FONT></FONT><FONT size=2>,<BR>renderTo: </FONT><FONT
color=#a31515 size=2><FONT color=#a31515 size=2>'legend'</FONT></FONT><FONT
size=2>,<BR>root: layerList_Labels,<BR>enableDD: </FONT><FONT color=#0000ff
size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT
size=2>,<BR>applyLoader: </FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true<BR></FONT></FONT><FONT size=2>});</FONT></P></SPAN>
<DIV>
<HR>
This e-mail is intended for the original recipient(s) only. If you have
received it in error, please advise the sender and delete this message. </DIV><PRE wrap=""><FIELDSET class=mimeAttachmentHeader></FIELDSET>
_______________________________________________
Users mailing list
<A class=moz-txt-link-abbreviated href="mailto:Users@geoext.org">Users@geoext.org</A>
<A class=moz-txt-link-freetext href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</A>
</PRE></BLOCKQUOTE><BR><PRE class=moz-signature cols="72">--
Ryan Williams, GISP
GIS Analyst / Programmer
PAQ Interactive Inc.
107 S State St., Suite 300
Monticello, IL 61856-1968
Office: (217) 762-7955
Mobile: (217) 722-2794
<A class=moz-txt-link-abbreviated href="mailto:rwilliams@paqinteractive.com">rwilliams@paqinteractive.com</A></PRE>
<DIV>
<P>
<HR>
[This message has been scanned for security content threats and
viruses.]<BR><BR>[The City of Red Deer I.T. Services asks that you please
consider the environment before printing this e-mail.]<BR>
<P></P></DIV>
<DIV><P><HR>
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
</P></DIV>
</BODY></HTML>