Dynamic layers fail when map layers not visible by default

521
0
11-17-2014 08:41 PM
BryanBaker
Occasional Contributor

I attempted to use the sample "Reorder Layers in a Map Service" (Reorder layers in map service | ArcGIS API for JavaScript ) with my map service. However, only the layers that were on by default would draw when their checkboxes were checked. I was able to get the non-default-visible layers to draw by removing the .defaultVisibility property in the dynamicLayerInfos array after startup (in the buildLayerList function).

I could not find a publicly available map service to test this with (i.e., one that supports dynamic layers but has one or more layers not visible by default), but manipulated the original sample to set some layers to mimic default visibility to off. See this JSBIN for the modified sample. Checking the layers on in this version does nothing. You can set the OVERRIDE var to false and it'll skip the modifications to run as original sample, in which the layers do turn on properly.

http://jsbin.com/xosoxijibi/1/edit?js,output

Am I missing something, or is there an issue with dynamic layers and layers not visible by default?

0 Kudos
0 Replies