Select to view content in your preferred language

Is it possible to add graphics behind a feature layer?

1572
3
11-29-2012 06:07 AM
BrettGreenfield__DNR_
Occasional Contributor II
I'm using a graphics layer to create a highlight symbol for when a user clicks on a point feature layer.  I have some events that listen for double-clicks or mouse hovers on the feature layer, but once a user clicks it and the highlight symbol is added, the events no longer work as the feature layer is covered by the graphic layer.  I could re-work the events to listen for double-clicks on the graphic layer, but I'd rather not do that.

I found a post on stackexchange.com that shows how to use the graphic.getDojoShape().moveToBack() method, but it appears it only adds the new graphics under existing graphics, and not feature layers.  Is it possible to do what I'm attempting, or will graphic layers always be added on top of feature layers?
0 Kudos
3 Replies
JohnGravois
Frequent Contributor
i'm pretty sure that the generic map.graphics layer always draws on top, but if you instantiate a named graphics layer instead you can take advantage of map.reorderLayers() (or just add the named graphics layer to the map before you add the featureLayer) to ensure that the featureLayer draws on top of the graphics layer.
0 Kudos
BrettGreenfield__DNR_
Occasional Contributor II
Ah, such a simple solution - adding the named graphics layer before the feature layer worked.  Thanks!
0 Kudos
JohnGravois
Frequent Contributor
glad to hear it 🙂
0 Kudos