I’m not sure if this is what you need but this works for me at the tree leaf 
level.

 

nodeType: "gx_layer",

                layer      : layerStore['LGATE-008'],

                text        : layerStore['LGATE-008'],

                isLeaf    : true,

                disabled: disablePublic

                ,id : layerStore['LGATE-008']

 

I set disablePublic to true if the service is broken which I test at load time. 
If I needed to do this based on scale during the processing I would probably 
setup an OL zoomend event and reset this via the layer Id and this node Id. 

 

Hope that helps.

 

Brad....

 

 

From: users-boun...@geoext.org [mailto:users-boun...@geoext.org] On Behalf Of 
Robert Buckley
Sent: Monday, 25 July 2011 10:30 PM
To: users@geoext.org
Subject: [Users] Disable treenode according to scale

 

Hi,

this code turns off the layer "layer_wea_wms" when I zoom out by more than 
zoomlevel 8. What I  would actually like to do is complete disable the treenode 
as well so that it is impossible to make it visible.

I have tried to get a reference to the treenodes by name, but I cannot return 
the object. The treenodes are loaded automatically using the code below

Does anyone know how I could disable the node?


thanks,


Rob



// TREE
var layerList = new Ext.tree.TreeNode({
            text: "Kartenebene",
            
            expanded: true
            });
    layerRoot.appendChild(new GeoExt.tree.BaseLayerContainer({
            text: "Hintergrundkarten",
            map: map,
            expanded: true
            }));
    layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
            text: "Themen",
            map: map,
            expanded: true
            }));
    var layerTree = new Ext.tree.TreePanel({
        title: "Karteninhalte",
        region: "center",
        root: layerRoot,
        enableDD: true,
        collapsible: true,
        height: 200,
        expanded: true
    });        



// Scale dependant layer
map.events.on({ "zoomend": function (e) {
      if (this.getZoom() > 9) {
    
      layer_wea_wms.setVisibility(true);
                  
      }
      else {
      layer_wea_wms.setVisibility(false);
      }
           }//end function (e)
    }); //end map.events.on 

 

_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to