I've done something similar, here's my code:
map.events.register("zoomend", map, function(){ var mapZoom = map.getZoom(); var treeLayers = Ext.getCmp('lyrsTree'); var nodeLimAdmin = treeLayers.getNodeById('limitsAdmin'); var layerLimAdmin = map.getLayersByName("limadmin")[0]; if(mapZoom > 5){ layerLimAdmin.setVisibility(false); if(Ext.isDefined(nodeLimAdmin))nodeLimAdmin.disable(); }else{ if(Ext.isDefined(nodeLimAdmin))nodeLimAdmin.enable(); } }); Hope this helps you. Antoni Vidal Unitat d'Aplicacions SIG-WEB Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392> Parc de Montjuïc, E-08038 Barcelona Tel. (+34) 93 567 15 00 (ext. 3228) www.icc.cat <http://www.icc.cat/> De: users-boun...@geoext.org [mailto:users-boun...@geoext.org] En nom de Robert Buckley Enviat: martes, 21 de febrero de 2012 14:51 Per a: users@geoext.org Tema: [Users] How can I enabe,check node and change the visibility of basemaps with zoomlevel? Hi, I am trying to turn off my basemaps according to the current zoom level....ie for zoom levels over 6 show,enable and check "layer_0", otherwise show,enable and check "layer_1" <code> map.events.on({ "zoomend": function (e) { if (this.getZoom() >6) { layerTree.getRootNode().findChild('layer', layer_0, true).disable(); layer_0.setVisibility(false); layerTree.getRootNode().findChild('layer', layer_0 , true).checked==false; } else { layerTree.getRootNode().findChild('layer', layer_1, true).disable(); layer_1.setVisibility(true); layerTree.getRootNode().findChild('layer', layer_1 , true).checked==true; } } }); The problems are as follows... 1. The nodes do not "check" 2. The disable method works ok, but when I zoom out again the layer still remains visible but does not zoom?!? Has anyone done this successfully and can show me how? yours, Rob
_______________________________________________ Users mailing list Users@geoext.org http://www.geoext.org/cgi-bin/mailman/listinfo/users