Hello GeoExt Users,<br><br>I have a zoom event that when a user zoom in and out of my map certain layers I setVisibility(false). Now what I would like to do is have another event inside that event which disables the nodes of those layers when their setVisibilty(false) and enables them back when setVisibility(true). I have some code and it kinda works, but the problem is the checkchange event does not only work when the zoomend event is done, but also anytime a user clicks the layer nodes. I played a little with stopPropagation and that didn't do anything for me. Actually I think my zoomend event could be much better coded and I would really love some suggestions. I appreciate everyone taking their time to help me :)<br>
<br>elshae<br><br>Code:<br><br>map.events.on({ "zoomend": function (e) {<br><br> layerTree.on("checkchange", function (node, checked) {<br> alert(node.text + "Inside event");<br>
if(checked == false)<br> node.disable();<br> else if(checked == true)<br> node.enable();<br><br> });<br> <br>
if (this.getZoom() > 7) {<br> tib_villages.setVisibility(true);<br> tib_lakes.setVisibility(true);<br> tib_townships.setVisibility(true);<br>
<br> <br> }<br> else {<br><br> tib_villages.setVisibility(false);<br> tib_lakes.setVisibility(false);<br>
tib_townships.setVisibility(false);<br> //alert(layerTree.tib_villages.node.text);<br> <br> if (this.getZoom() > 5) {<br>
infrastructure.setVisibility(true);<br> geography.setVisibility(true);<br> geography2.setVisibility(true);<br> tib_countys.setVisibility(true);<br>
<br> }<br> else{<br> infrastructure.setVisibility(false);<br> geography.setVisibility(false);<br>
geography2.setVisibility(false);<br> tib_countys.setVisibility(false);<br> }<br> }//end else<br> <br>
}//end function (e)<br> <br> }); //end map.events.on<br>