LuciH

first dynamic layer on top cannot turn off visibility

Discussion created by LuciH on May 8, 2012
I am using the basemapgallery, a legend, and a TOC.  Everything is working fine except for the very first dynamicmapservicelayer that I add using   map.addLayer.(layername);   is staying on TOP of all of the other layers and will not change visibility when I use the checkbox in the TOC.  I am not using any featurelayers.  I want to be able to turn on/off all dynamic layers.  Is this a bug?

I have 4 dynamic layers loading using syntax like:

var layernameLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://...../Mapserver", {visible:true}
map.addLayer(layernameLayer);

I removed the map.addLayer(layernameLayer); after each one and combined them into:
map.addLayers([layernameLayer, layernameLayer, etc.]);

Now, none of the four layers can be set to on/off in TOC.   baffling!

I take that back, still the first one listed is the only one on TOP that cannot be set to visibility:false.

Thanks,

Luci

Outcomes