<!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.18999"><!-- converted from rtf -->
<STYLE>.EmailQuote {
        BORDER-LEFT: #800000 2px solid; PADDING-LEFT: 4pt; MARGIN-LEFT: 1pt
}
</STYLE>
</HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 name="Compose message area"
CanvasTabStop="true">
<DIV dir=ltr align=left><SPAN class=027315817-28122010><FONT size=2
face=Arial>Thanks for your suggestion.. I tried to use this method but for some
reason when checking a childnode the event is not firing. I seem to have found
an alternate way to do this by adding the checkchange listener directly to my
treepanel and then using the ID property to get the name of the childnode.. but
your method seems much easier. Do you know why my setup might prohibit the event
from firing correctly when checking/unchecking a childnode? Here is my code..
appreciate your assistance and if I can't do it this way I guess I will just
stick to how I've got it.. works anyway but it's not
pretty :)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=027315817-28122010><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=027315817-28122010><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>var</FONT></FONT><FONT size=2> layerRoot_Legend = </FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2>
Ext.tree.TreeNode({<BR>enableDD: </FONT><FONT color=#0000ff size=2><FONT
color=#0000ff size=2>true</FONT></FONT><FONT size=2>,<BR>loaded: </FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT
size=2>,<BR>expanded: </FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true<BR></FONT></FONT><FONT size=2>});</P></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=027315817-28122010><FONT color=#0000ff
size=2 face=Arial><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>var</FONT></FONT><FONT size=2> layerTree_Legend = </FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2>
Ext.tree.TreePanel({<BR>root: layerRoot_Legend,<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</FONT></FONT><FONT size=2>,<BR>height: 372,<BR>width:
230,<BR>autoScroll: </FONT><FONT color=#0000ff size=2><FONT color=#0000ff
size=2>true</FONT></FONT><FONT size=2>,<BR>rootVisible: </FONT><FONT
color=#0000ff size=2><FONT color=#0000ff size=2>false</FONT></FONT><FONT
size=2><BR></FONT></FONT></SPAN><SPAN class=027315817-28122010><FONT
size=2>}}</P></DIV></FONT></SPAN>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff><FONT color=#008000 size=2 face=Arial>
//AOIs layerList</FONT>
<DIV><FONT size=2 face=Arial>
layerList_AOIs = <FONT color=#0000ff>new</FONT>
GeoExt.tree.LayerNode({</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"layer"</FONT>: layer_AOIs,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"isLeaf"</FONT>: <FONT color=#0000ff>true</FONT>,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"preloadChildren"</FONT>: <FONT
color=#0000ff>true</FONT>,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"checked"</FONT>: <FONT color=#0000ff>false</FONT>,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"enableDD"</FONT>: <FONT color=#0000ff>true</FONT>,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"cls"</FONT>: <FONT color=#a31515>"rootnode"</FONT>,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"singleClickExpand"</FONT>: <FONT
color=#0000ff>true</FONT>,</FONT></DIV>
<DIV><FONT size=2 face=Arial> <FONT
color=#a31515>"listeners"</FONT>: </FONT></DIV>
<DIV><FONT size=2 face=Arial>
{</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#a31515>'checkchange'</FONT> : <FONT
color=#0000ff>function</FONT>(node, checked)</FONT></DIV>
<DIV><FONT size=2
face=Arial>
{</FONT></DIV>
<DIV><FONT face=Arial><FONT
size=2>
<FONT color=#008000>// If a parent node is unchecked, uncheck all the
children</FONT></FONT></FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>if</FONT> (node.getUI().isChecked()) {</FONT></DIV>
<DIV><FONT size=2
face=Arial>
node.expand();</FONT></DIV>
<DIV><FONT size=2
face=Arial>
}</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>if</FONT> (!node.getUI().isChecked()) {</FONT></DIV>
<DIV><FONT size=2
face=Arial>
node.collapse();</FONT></DIV>
<DIV><FONT size=2
face=Arial>
}</FONT></DIV>
<DIV><FONT size=2
face=Arial>
},</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#a31515>'load'</FONT> : <FONT color=#0000ff>function</FONT>(e)
{</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>if</FONT> (bool_aois == <FONT
color=#0000ff>false</FONT>)</FONT></DIV>
<DIV><FONT size=2
face=Arial>
{</FONT></DIV>
<DIV><FONT face=Arial><FONT
size=2>
<FONT color=#008000>//change icon of childNodes to GetLegendGraphic from WMS +
node text attribute</FONT></FONT></FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>var</FONT> count = (e.childNodes.length -1);</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>while</FONT> (count >= 0)</FONT></DIV>
<DIV><FONT size=2
face=Arial>
{</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>var</FONT> label =
e.childNodes[count].text;
</FONT></DIV>
<DIV><FONT size=2
face=Arial>
<FONT color=#0000ff>var</FONT> fixed_label = label.replace(/_/g,<FONT
color=#a31515>' '</FONT>);</FONT></DIV>
<DIV><FONT size=2
face=Arial>
e.childNodes[count].setText(<FONT color=#a31515>"<img
src='http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1&format=image/png&style=&layer="</FONT>+label
+ <FONT color=#a31515>"'/>"</FONT> + <FONT color=#a31515>' '</FONT>
+fixed_label);</FONT></DIV>
<DIV><FONT size=2
face=Arial>
count -=1;</FONT></DIV>
<DIV><FONT size=2
face=Arial>
}</FONT></DIV>
<DIV><FONT size=2
face=Arial>
bool_aois = <FONT color=#0000ff>true</FONT>;</FONT></DIV>
<DIV><FONT size=2
face=Arial>
}</FONT></DIV>
<DIV><FONT face=Arial><FONT
size=2>
<FONT color=#0000ff>else</FONT></FONT></FONT></DIV>
<DIV><FONT size=2
face=Arial>
{</FONT></DIV>
<DIV><FONT face=Arial><FONT
size=2>
<FONT color=#008000>//do nothing</FONT></FONT></FONT></DIV>
<DIV><FONT size=2
face=Arial>
}</FONT></DIV>
<DIV><FONT size=2
face=Arial>
} </FONT></DIV>
<DIV><FONT size=2 face=Arial> },</FONT></DIV>
<DIV><FONT size=2><FONT face=Arial>
</FONT><FONT color=#a31515 face=Arial>"loader": { </FONT></FONT></DIV>
<DIV><FONT color=#a31515 size=2
face=Arial>
"param": "LAYERS",</FONT></DIV>
<DIV><FONT color=#a31515 size=2
face=Arial> baseParams:{</FONT></DIV>
<DIV><FONT color=#a31515 size=2
face=Arial>
listeners:{checkchange:function(node,checked){</FONT></DIV>
<DIV><FONT color=#a31515 size=2
face=Arial> <SPAN
class=027315817-28122010>alert('making it here');</SPAN></FONT></DIV>
<DIV><FONT color=#a31515 size=2 face=Arial><SPAN
class=027315817-28122010></SPAN>
}}</FONT></DIV>
<DIV><FONT color=#a31515 size=2
face=Arial>
}</FONT></DIV>
<DIV><FONT size=2 face=Arial>
});</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2>
<P>layerRoot_Legend.appendChild(layerList_AOIs);</P></FONT></DIV></FONT></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Matt Priour
[mailto:mpriour@kestrelcomputer.com] <BR><B>Sent:</B> December 28, 2010 10:49
AM<BR><B>To:</B> Andrew Stewart; users@geoext.org<BR><B>Subject:</B> Re: [Users]
Capturing Name of childnode clicked
fromGeoExt.tree.LayerNode<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT size=2 face=Arial>You could add this to the loader at the end of your
configuration:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>...</FONT></DIV>
<DIV><FONT size=2 face=Arial><FONT color=#a31515>"loader"</FONT>: {
<DIV> <FONT
color=#a31515>"param"</FONT>: <FONT color=#a31515>"LAYERS",</FONT></DIV>
<DIV><FONT
color=#a31515> baseParams:{</FONT></DIV>
<DIV><FONT
color=#a31515>
listeners:{checkchange:function(node,checked){</FONT></DIV>
<DIV><FONT
color=#a31515>
.... Do Something with checked child node information ....</FONT></DIV>
<DIV><FONT
color=#a31515>
}}</FONT></DIV>
<DIV><FONT
color=#a31515>
}</FONT></DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV>'baseParams' are applied to each child node created by the loader.</DIV>
<DIV> </DIV>
<DIV>Matt Priour</DIV>
<DIV>Kestrel Computer Consulting</DIV></FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=Andrew.Stewart@reddeer.ca
href="mailto:Andrew.Stewart@reddeer.ca">Andrew Stewart</A> </DIV>
<DIV><B>Sent:</B> Tuesday, December 28, 2010 11:16 AM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org
href="mailto:users@geoext.org">users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] Capturing Name of childnode clicked
fromGeoExt.tree.LayerNode</DIV></DIV></DIV>
<DIV><FONT size=2 face=Arial></FONT><BR></DIV><FONT size=2 face="Courier New">
<DIV>I'm sure this can be done but I'm having a hell of a time accomplishing
this. I need to know which childnode has been clicked from my layerNode (which
is added to a layertree root node). Except I am using grouped layers through
openlayers so I am having a hard time pulling out the name of one of these child
nodes. Is there any event I can add to the below code to tell me the name of the
childnode when it is clicked and not the root node? Appreciate any advice.</DIV>
<DIV> </DIV>
<DIV><FONT color=#008000>
//AOIs layerList</FONT></DIV>
<DIV> layerList_AOIs = <FONT
color=#0000ff>new</FONT> GeoExt.tree.LayerNode({</DIV>
<DIV> <FONT
color=#a31515>"layer"</FONT>: layer_AOIs,</DIV>
<DIV> <FONT
color=#a31515>"isLeaf"</FONT>: <FONT color=#0000ff>true</FONT>,</DIV>
<DIV> <FONT
color=#a31515>"preloadChildren"</FONT>: <FONT color=#0000ff>true</FONT>,</DIV>
<DIV> <FONT
color=#a31515>"checked"</FONT>: <FONT color=#0000ff>false</FONT>,</DIV>
<DIV> <FONT
color=#a31515>"enableDD"</FONT>: <FONT color=#0000ff>true</FONT>,</DIV>
<DIV> <FONT
color=#a31515>"cls"</FONT>: <FONT color=#a31515>"rootnode"</FONT>,</DIV>
<DIV> <FONT
color=#a31515>"singleClickExpand"</FONT>: <FONT color=#0000ff>true</FONT>,</DIV>
<DIV> <FONT
color=#a31515>"listeners"</FONT>: </DIV>
<DIV> {</DIV>
<DIV> <FONT
color=#a31515>'checkchange'</FONT> : <FONT
color=#0000ff>function</FONT>(node, checked)</DIV>
<DIV>
{</DIV>
<DIV>
<FONT color=#008000>// If a parent node is unchecked, uncheck all the
children</FONT></DIV>
<DIV>
<FONT color=#0000ff>if</FONT> (node.getUI().isChecked()) {</DIV>
<DIV>
node.expand();</DIV>
<DIV>
}</DIV>
<DIV>
<FONT color=#0000ff>if</FONT> (!node.getUI().isChecked()) {</DIV>
<DIV>
node.collapse();</DIV>
<DIV>
}</DIV>
<DIV>
},</DIV>
<DIV>
<FONT color=#a31515>'load'</FONT> : <FONT color=#0000ff>function</FONT>(e)
{</DIV>
<DIV>
<FONT color=#0000ff>if</FONT> (bool_aois == <FONT
color=#0000ff>false</FONT>)</DIV>
<DIV>
{</DIV>
<DIV>
<FONT color=#008000>//change icon of childNodes to GetLegendGraphic from WMS +
node text attribute</FONT></DIV>
<DIV>
<FONT color=#0000ff>var</FONT> count = (e.childNodes.length -1);</DIV>
<DIV>
<FONT color=#0000ff>while</FONT> (count >= 0)</DIV>
<DIV>
{</DIV>
<DIV>
<FONT color=#0000ff>var</FONT> label =
e.childNodes[count].text;
</DIV>
<DIV>
<FONT color=#0000ff>var</FONT> fixed_label = label.replace(/_/g,<FONT
color=#a31515>' '</FONT>);</DIV>
<DIV>
e.childNodes[count].setText(<FONT color=#a31515>"<img
src='http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1&format=image/png&style=&layer="</FONT>+label
+ <FONT color=#a31515>"'/>"</FONT> + <FONT color=#a31515>' '</FONT>
+fixed_label);</DIV>
<DIV>
count -=1;</DIV>
<DIV>
}</DIV>
<DIV>
bool_aois = <FONT color=#0000ff>true</FONT>;</DIV>
<DIV>
}</DIV>
<DIV>
<FONT color=#0000ff>else</FONT></DIV>
<DIV>
{</DIV>
<DIV>
<FONT color=#008000>//do nothing</FONT></DIV>
<DIV>
}</DIV>
<DIV>
} </DIV>
<DIV> },</DIV>
<DIV> <FONT
color=#a31515>"loader"</FONT>: {</DIV>
<DIV> <FONT
color=#a31515>"param"</FONT>: <FONT color=#a31515>"LAYERS"</FONT></DIV>
<DIV> }</DIV>
<DIV> });</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face="Arial, sans-serif"></FONT> </DIV></FONT>
<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></P></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR>
<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>