This webmap project I keep working accesses mutilple layers within a couple different mapservices. I would like to learn how I can load the layers without them drawing. I've recently incorporated check boxes instead of links to turn each layer on and off. They work but in the reverse way I want them to.

I've not been able to figure out how to keep the layers from drawing until I select a checkbox.

here is a link..



I use the visible parameter of the options when I create the layer:

var layer = new esri.layers.ArcGISDynamicMapServiceLayer(mapServic eUrl, { id: layerId, visible: false});

The id parameter lets you specify the name of the layer, so you can use the name to get the layer from the map's layer collection. The visible parameter set the default visibility of the layer.

See the constructor in JSAPI Reference for ArcGISDynamicMapServiceLayer .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy