[Users] Tooltip using Param for layers in a GeoExt.tree.LayerNode
Andrew Stewart
Andrew.Stewart at reddeer.ca
Mon Dec 20 16:46:50 CET 2010
I am trying to display the minscale/maxscale of a specific layer as a tooltip when the user hoves over the legend item in the LayerNode. With the below code I am getting the tooltip properly but only on the very root of the tree item and not it's children. Is there anyway to use the param variable so that I can put these tooltips on the childnodes instead.. As some of the min/max scales are different. I tried to use the layer.params but could not get it working. Appreciate any advice!
//AOIs layerList
layerList_AOIs = new GeoExt.tree.LayerNode({
"layer": layer_AOIs,
"isLeaf": true,
"preloadChildren": true,
"checked": false,
"enableDD": true,
"cls": "rootnode",
"qtip": layer_AOIs.maxScale + ':' + layer_AOIs.minScale, //this works fine but need it for child nodes instead
"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.1&format=image/png&style=&layer="+label + "'/>" + ' ' +fixed_label);
count -=1;
}
bool_aois = true;
}
else
{
//do nothing
}
}
},
"loader": {
"param": "LAYERS"
}
});
And my actual layer is declared like so -
//Areas of Interest Group
var layer_AOIs = new OpenLayers.Layer.WMS("Areas of Interest", "http://localhost/WebServices/Request.aspx",
{
layers: ['Community_Shelter', 'Hotel_Motel', 'Library', 'Museum', 'Theatre', 'Place_of_Worship', 'Parking', 'City_Facility', 'Recreation', 'School_Age_Program', 'School' , 'Major_Commercial_Centre' , 'Hospital' , 'Police_Station' , 'Fire_Hall' , 'Attraction'],
VERSION: "1.1.1",
transparent: true
},
{ isBaseLayer: false,
singleTile: true,
visibility: false,
buffer: 1,
ratio: 1
}
);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101220/22ef3f06/attachment.htm
More information about the Users
mailing list