[Users] Question about turning on entire group of layers in layercontainer/treenode
Andrew Stewart
Andrew.Stewart at reddeer.ca
Fri Sep 17 17:23:35 CEST 2010
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.
//Labels LayerList
var layerList_Labels = new GeoExt.tree.LayerContainer({
text: 'Labels',
layerStore: mapPanel.layers,
leaf: false,
cls: 'rootnode',
enableDD: true,
expanded: false,
loader:
{
filter: function(record)
{
var myarr = new Array();
myarr[0] = record.get("layer").name.indexOf("Overview Streets");
myarr[1] = record.get("layer").name.indexOf("Quadrant Streets");
myarr[2] = record.get("layer").name.indexOf("Neighbourhood Streets");
myarr[3] = record.get("layer").name.indexOf("Block Streets");
myarr[4] = record.get("layer").name.indexOf("Proposed Streets");
myarr[5] = record.get("layer").name.indexOf("Address Label (Overview)");
myarr[6] = record.get("layer").name.indexOf("Address Label (Detail)");
if(myarr[0]==-1 && myarr[1]==-1 && myarr[2]==-1 && myarr[3]==-1 && myarr[4]==-1 && myarr[5]==-1 && myarr[6]==-1)
{
return false;
}
else
{
return true;
}
}
}
});
//declare root tree node
var layerRoot = new Ext.tree.TreeNode({
enableDD: true,
text: "All Legend Items",
expanded: true
});
//add children to root node
layerRoot.appendChild(layerList_Labels)
var layerTree = new Ext.tree.TreePanel({
title: '',
renderTo: 'legend',
root: layerRoot,
enableDD: true,
applyLoader: true,
rootVisible: false
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100917/76331fb8/attachment.htm
More information about the Users
mailing list