<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18939"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT size=2 face=Arial><SPAN
class=179453615-17092010>Sorry didn't realize it was pasted all messed up, here
is the code a little more readable thanks</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=179453615-17092010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=179453615-17092010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial></FONT> </DIV>
<DIV dir=ltr align=left><FONT size=2
face=Arial> //Labels LayerList
<BR> var layerList_Labels = new
GeoExt.tree.LayerContainer({<BR> text:
'Labels',<BR> layerStore:
mapPanel.layers,<BR> leaf:
false,<BR> cls:
'rootnode',<BR> enableDD:
true,<BR> expanded:
false,<BR> loader:
<BR>
{<BR> filter:
function(record)
<BR>
{<BR>
var myarr = new
Array();<BR>
myarr[0] = record.get("layer").name.indexOf("Overview
Streets");<BR>
myarr[1] = record.get("layer").name.indexOf("Quadrant
Streets");<BR>
myarr[2] = record.get("layer").name.indexOf("Neighbourhood
Streets");<BR>
myarr[3] = record.get("layer").name.indexOf("Block
Streets");<BR>
myarr[4] = record.get("layer").name.indexOf("Proposed
Streets");<BR>
myarr[5] = record.get("layer").name.indexOf("Address Label
(Overview)");<BR>
myarr[6] = record.get("layer").name.indexOf("Address Label
(Detail)");<BR>
if(myarr[0]==-1 && myarr[1]==-1 && myarr[2]==-1 &&
myarr[3]==-1 && myarr[4]==-1 && myarr[5]==-1 &&
myarr[6]==-1)<BR>
{<BR>
return
false;<BR>
}<BR>
else<BR>
{<BR>
return
true;<BR>
}<BR>
}<BR>
}<BR> });</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT size=2
face=Arial><BR> //declare root tree
node<BR> var layerRoot = new
Ext.tree.TreeNode({<BR>
enableDD:
true,<BR>
text: "All Legend
Items",<BR>
expanded:
true<BR>
});<BR>
<BR> //add children to root
node<BR>
layerRoot.appendChild(layerList_Labels)<BR>
layerRoot.appendChild(layerlist_AOI)<BR>
layerRoot.appendChild(layerlist_Trails)<BR>
layerRoot.appendChild(layerlist_Footprints)<BR>
layerRoot.appendChild(layerlist_LegalFabric)<BR>
layerRoot.appendChild(layerlist_ParcelFabric)<BR>
layerRoot.appendChild(layerlist_Base)<BR>
layerRoot.appendChild(layerlist_Orthos)<BR>
<BR>
<BR> var layerTree = new
Ext.tree.TreePanel({<BR> title:
'',<BR> renderTo:
'legend',<BR> root:
layerRoot,<BR> enableDD:
true,<BR> applyLoader:
true,<BR> rootVisible:
false<BR></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Pol [mailto:d.paolino@gmail.com]
<BR><B>Sent:</B> September 17, 2010 9:33 AM<BR><B>To:</B> Andrew
Stewart<BR><B>Subject:</B> Re: [Users] Question about turning on entire group of
layers in layercontainer/treenode<BR></FONT><BR></DIV>
<DIV></DIV>Dude,
<DIV><BR></DIV>
<DIV>Is it possible for you to indent your code ? It's really easier to read and
to understand it...</DIV>
<DIV><BR></DIV>
<DIV>Thanks !</DIV>
<DIV><BR clear=all>-Pol D.-<BR><A
href="http://www.google.com/profiles/110003197662276240659"
target=_blank>http://www.google.com/profiles/110003197662276240659</A><BR><BR><BR>
<DIV class=gmail_quote>On Fri, Sep 17, 2010 at 17:23, Andrew Stewart <SPAN
dir=ltr><<A
href="mailto:Andrew.Stewart@reddeer.ca">Andrew.Stewart@reddeer.ca</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV text="#000000" bgcolor="#ffffff">
<P><FONT size=2><SPAN><FONT face=Arial> I have a layerlist that is
working fine and being entered into a layercontainer/treepanel to show all my
layers. Everything works fine but I am wondering if there is a way to turn on
all layers by adding a checkbox to the group much like checkboxes are next to
all individual layers I have. Appreciate any advice on how to modify my
existing code to accomplish this so I can turn all my layers on by clicking
the group (root layer) or if there is another way to do this,
thanks.</FONT></SPAN></FONT></P>
<P><FONT color=#008000><FONT color=#008000><FONT
size=2><SPAN> </SPAN>//Labels LayerList </FONT></FONT></FONT></P><FONT
size=2>
<P></P></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({
<P>text: </P></FONT><FONT color=#a31515 size=2><FONT color=#a31515
size=2>'Labels'</FONT></FONT><FONT size=2>,
<P>layerStore: mapPanel.layers,</P>
<P>leaf: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>false</FONT></FONT><FONT size=2>,
<P>cls: </P></FONT><FONT color=#a31515 size=2><FONT color=#a31515
size=2>'rootnode'</FONT></FONT><FONT size=2>,
<P>enableDD: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true</FONT></FONT><FONT size=2>,
<P>expanded: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>false</FONT></FONT><FONT size=2>,
<P>loader: </P>
<P>{</P>
<P>filter: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>function</FONT></FONT><FONT size=2>(record)
<P>{</P>
<P></P></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();
<P>myarr[0] = record.</P></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>);
<P>myarr[1] = record.</P></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>);
<P>myarr[2] = record.</P></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>"Neighbourhood Streets"</FONT></FONT><FONT size=2>);
<P>myarr[3] = record.</P></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>"Block Streets"</FONT></FONT><FONT size=2>);
<P>myarr[4] = record.</P></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>"Proposed Streets"</FONT></FONT><FONT size=2>);
<P>myarr[5] = record.</P></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>"Address Label (Overview)"</FONT></FONT><FONT size=2>);
<P>myarr[6] = record.</P></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>"Address Label (Detail)"</FONT></FONT><FONT size=2>);
<P></P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>if</FONT></FONT><FONT size=2>(myarr[0]==-1 && myarr[1]==-1
&& myarr[2]==-1 && myarr[3]==-1 && myarr[4]==-1
&& myarr[5]==-1 && myarr[6]==-1)
<P>{</P>
<P></P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>return</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2><FONT color=#0000ff size=2>false</FONT></FONT><FONT size=2>;
<P>}</P>
<P></P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>else</FONT></FONT><FONT size=2>
<P>{</P>
<P></P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>return</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;
<P>}</P>
<P>}</P>
<P>}</P>
<P>});</P>
<P></P>
<P></P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//declare
root tree node</FONT></FONT><FONT size=2>
<P></P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>var</FONT></FONT><FONT size=2> layerRoot = </FONT><FONT color=#0000ff
size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2>
Ext.tree.TreeNode({
<P>enableDD: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true</FONT></FONT><FONT size=2>,
<P>text: </P></FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"All
Legend Items"</FONT></FONT><FONT size=2>,
<P>expanded: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true</FONT></FONT><FONT size=2>
<P>});</P>
<P></P>
<P></P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//add
children to root node</FONT></FONT><FONT size=2>
<P>layerRoot.appendChild(layerList_Labels)</P>
<P></P>
<P></P>
<P></P></FONT><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({
<P>title: </P></FONT><FONT color=#a31515 size=2><FONT color=#a31515
size=2>''</FONT></FONT><FONT size=2>,
<P>renderTo: </P></FONT><FONT color=#a31515 size=2><FONT color=#a31515
size=2>'legend'</FONT></FONT><FONT size=2>,
<P>root: layerRoot,</P>
<P>enableDD: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true</FONT></FONT><FONT size=2>,
<P>applyLoader: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true</FONT></FONT><FONT size=2>,
<P>rootVisible: </P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>false</FONT></FONT><FONT size=2>
<P>});</P></FONT>
<DIV>
<P></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></P></DIV></DIV><BR>_______________________________________________<BR>Users
mailing list<BR><A href="mailto:Users@geoext.org">Users@geoext.org</A><BR><A
href="http://www.geoext.org/cgi-bin/mailman/listinfo/users"
target=_blank>http://www.geoext.org/cgi-bin/mailman/listinfo/users</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV>
<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>