[Users] Question on adding multiple layercontainer to TreePanel
Andrew Stewart
Andrew.Stewart at reddeer.ca
Wed Sep 1 18:08:06 CEST 2010
Trying to find a good example on how to add multiple LayerContainers to my TreePanel but so far unsuccesful.
I've defined two LayerContainer controls like so -
var layerList_Labels = new GeoExt.tree.LayerContainer({
text: 'Labels',
layerStore: mapPanel.layers,
leaf: false,
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");
if(myarr[0]==-1 && myarr[1]==-1)
{
return false;
}
else
{
return true;
}
}
}
});
var layerList_Labels2 = new GeoExt.tree.LayerContainer({
text: 'Labels2',
layerStore: mapPanel.layers,
leaf: false,
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");
if(myarr[0]==-1 && myarr[1]==-1)
{
return false;
}
else
{
return true;
}
}
}
});
Now I am just unsure exactly how to add these both to my TreePanel - i've tried adding them both to root, or trying to use children but it is not showing up. Any help greatly appreciated.
var layerTree = new Ext.tree.TreePanel({
title: '',
renderTo: 'legend',
root: layerList_Labels,
enableDD: true,
applyLoader: true
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100901/783ef1d8/attachment.htm
More information about the Users
mailing list