AnsweredAssumed Answered

4.x MapImageLayer sublayer not honoring visible attribute in constructor

Question asked by derek.miller4 on May 16, 2018
Latest reply on May 17, 2018 by derek.miller4

When defining the sublayer collection of a MapImageLayer using a MapService in which sublayer default visibility is false, the MapImageLayer ignores the visible parameter defined in the constructuror.

 

Example: all layers in the MapService have a default visibility of false. MapImageLayer defined with two sublayers set to visible:true. SubLayer visible param is ignored. Uncomment the zoningLayer.when() function, which explicitly sets sublayer visibility, layer draws.

 

JS Bin - Collaborative JavaScript Debugging 

 

Example two: Again, MapImageLayer with two sublayers. One sublayer with default visibility false in the MapService, the other with default visibility true in the map service. One sublayer draws, the other does not.

 

JS Bin - Collaborative JavaScript Debugging 

 

Is this the expected behaviour? Seems to me that if visibility is defined as true in the constructor, the sublayer should render on load without the extra step of setting visibility on load. Otherwise, why define visibility in the constructor?

Outcomes