How do I get the selected graphic to display on top of all the other graphics?

622
3
Jump to solution
05-07-2013 07:59 AM
SethCrotchett
New Contributor
I am adding graphics(markers) to the map and I am selecting a specific graphic(markers).  How do I go about making the selected graphic the top most graphic in layer?
0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor
Hi Seth,

The graphics class has a getDojoShape() method that can be used to change the graphic's drawing order. Once you have the dojo shape you can use the moveToFront and moveToBack methods to reorder the graphic.

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/graphic.html#getDojoShape


Kelly


I am adding graphics(markers) to the map and I am selecting a specific graphic(markers).  How do I go about making the selected graphic the top most graphic in layer?

View solution in original post

0 Kudos
3 Replies
TyroneLigon
Occasional Contributor
Two thoughts:

Find the graphic to move, create a new graphic, assign the "move" graphic to the new graphic, delete the "move" graphic, then add the new graphic to the graphics list

- OR -

Copy the graphics list to an array, manipulate the array, delete all the graphics from the graphics list, then assign the manipulated array to the graphics list

Sorry, I don't have a code example and I haven't tested any of this...
0 Kudos
KellyHutchins
Esri Frequent Contributor
Hi Seth,

The graphics class has a getDojoShape() method that can be used to change the graphic's drawing order. Once you have the dojo shape you can use the moveToFront and moveToBack methods to reorder the graphic.

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/graphic.html#getDojoShape


Kelly


I am adding graphics(markers) to the map and I am selecting a specific graphic(markers).  How do I go about making the selected graphic the top most graphic in layer?
0 Kudos
TyroneLigon
Occasional Contributor
Wow...scrolled right past that one. Seth, ignore what I posted and go with Kelly's solution.
0 Kudos