AnsweredAssumed Answered

Dynamic layers fail when map layers not visible by default

Question asked by bb1769 on Nov 17, 2014

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.,output


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