[Users] Capturing Name of childnode clicked fromGeoExt.tree.LayerNode
Matt Priour
mpriour at kestrelcomputer.com
Tue Dec 28 18:49:18 CET 2010
You could add this to the loader at the end of your configuration:
...
"loader": {
"param": "LAYERS",
baseParams:{
listeners:{checkchange:function(node,checked){
.... Do Something with checked child node information ....
}}
}
}
'baseParams' are applied to each child node created by the loader.
Matt Priour
Kestrel Computer Consulting
From: Andrew Stewart
Sent: Tuesday, December 28, 2010 11:16 AM
To: users at geoext.org
Subject: [Users] Capturing Name of childnode clicked fromGeoExt.tree.LayerNode
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.
//AOIs layerList
layerList_AOIs = new GeoExt.tree.LayerNode({
"layer": layer_AOIs,
"isLeaf": true,
"preloadChildren": true,
"checked": false,
"enableDD": true,
"cls": "rootnode",
"singleClickExpand": true,
"listeners":
{
'checkchange' : function(node, checked)
{
// If a parent node is unchecked, uncheck all the children
if (node.getUI().isChecked()) {
node.expand();
}
if (!node.getUI().isChecked()) {
node.collapse();
}
},
'load' : function(e) {
if (bool_aois == false)
{
//change icon of childNodes to GetLegendGraphic from WMS + node text attribute
var count = (e.childNodes.length -1);
while (count >= 0)
{
var label = e.childNodes[count].text;
var fixed_label = label.replace(/_/g,' ');
e.childNodes[count].setText("<img src='http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1&format=image/png&style=&layer="+label + "'/>" + ' ' +fixed_label);
count -=1;
}
bool_aois = true;
}
else
{
//do nothing
}
}
},
"loader": {
"param": "LAYERS"
}
});
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101228/73efc588/attachment-0001.htm
More information about the Users
mailing list