[Users] Capturing Name of childnode clicked from GeoExt.tree.LayerNode
Andrew Stewart
Andrew.Stewart at reddeer.ca
Tue Dec 28 18:16:39 CET 2010
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"
}
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101228/5d3f79cc/attachment.htm
More information about the Users
mailing list