[Users] Layer unvisible in LayerTree

Andreas Hocevar ahocevar at opengeo.org
Mon Jul 2 11:35:03 CEST 2012


Configure the layer with visibility: false as option. Instad of
setting checked: false on the tree node.

Andreas.

On Mon, Jul 2, 2012 at 8:36 AM, Jacinto Estima <jacinto.estima at gmail.com> wrote:
> Hi folks!
>
>
>
> I coded a tree using the following code. The tree is working, but I want the
> Layers under 2008 and 2009 nodes to be “unvisible”. The “checked: false”
> property is working but only for the tree because the layers appear
> activated in the map. Is there any property to make layers invisible in the
> map?
>
>
>
> Thanks,
>
> Jacinto
>
>
>
> layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
>
>               text: "2010",
>
>               layerStore: mapPanel.layers,
>
>               expanded: true,
>
>               enableDD: true,
>
>               loader: {
>
>                      filter: function(record) {
>
>             return record.get("layer").name.indexOf("2010") !== -1;
>
>         }},
>
>        }));
>
>
>
>        layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
>
>               text: "2009",
>
>               layerStore: mapPanel.layers,
>
>               expanded: true,
>
>               enableDD: true,
>
>               loader: {
>
>                      filter: function(record) {
>
>             return record.get("layer").name.indexOf("2009") !== -1;
>
>               },
>
>               baseAttrs: {
>
> //            checked: false,
>
> //            visible: false,
>
>         }},
>
>        }));
>
>
>
>        layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
>
>               text: "2008",
>
>               layerStore: mapPanel.layers,
>
>               expanded: true,
>
>               enableDD: true,
>
>               loader: {
>
>                      filter: function(record) {
>
>             return record.get("layer").name.indexOf("2008") !== -1;
>
>             console.log(record);
>
>         },
>
>               baseAttrs: {
>
>               checked: false,
>
> //            visible: false,
>
>         }},
>
>        }));
>
>
>
>        var LayerTree = new Ext.tree.TreePanel({
>
> //            title: 'Map Layers',
>
>               renderTo: 'layers',
>
>               root: layerRoot,
>
>        });
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list