thultgren

GraphicsLayers aren't always on top!

Discussion created by thultgren on Sep 29, 2010
Latest reply on Jul 5, 2011 by rianc
Hi JavaScript API folks,

According to the documentation of a GraphicsLayer,:

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/graphicslayer.htm
Graphics layers can be reordered within the group of graphics layers. However, the graphics layer in Map.Graphics is always on top. Also, all graphics layers are always on top of TiledMapServiceLayers and DynamicMapServiceLayers.


This isn't quite true.  On the page, Graphics Layers seem to end up in the following element:
<svg width="821" height="656" style="overflow: visible; position: absolute; z-index: 20;" id="mapDiv_gc">...</svg>
which as best I can tell is hard coded with a z-index of 20.  Fine, as long as you never have more than 21 map layers, since other map layers appear to be added with ascending z-index values.  For those of us just nutty enough to add more than 21 layers, though, our graphics get buried.  The z-index value isn't all that difficult to change after the fact with a dojo.style('mapDiv_gc','zIndex',40); command, but should this really be necessary - especially when the documentation is so adamant about graphics layers always being on top of other layers?  Thanks so much!

Outcomes