4.x MapImageLayer sublayer not honoring visible attribute in constructor

640
2
Jump to solution
05-16-2018 05:33 PM
DerekMiller1
New Contributor II

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?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Derek,

   the MapImagerLayer property is sublayers NOT subLayers.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Derek,

   the MapImagerLayer property is sublayers NOT subLayers.

DerekMiller1
New Contributor II

So it is. Thank you, Robert. That takes care of it.

0 Kudos