Select to view content in your preferred language

Map graphics Selection

947
2
05-07-2012 10:54 PM
praveenraorane
Emerging Contributor
How to get existing map graphics selection along with its attribute i.e layername,objectid ...
0 Kudos
2 Replies
TomJacoby
Occasional Contributor
var lastSelectedGraphic;

function init() {
 /**
 ** Do your init work here...
 **/
 map.graphics.enableMouseEvents();
 dojo.connect(map.graphics, "onClick", function(evt) {
  lastSelectedGraphic = evt.graphic;
  // You can do more work with the graphic here, but it is also stored for access anytime time later.
 });
}

init();


From there you can get what you need, I think.
0 Kudos
praveenraorane
Emerging Contributor
thanks tom for your response
the selection is not happening through mouse.
the problem is the map graphics are nothing but query results, which is a result of query fired or tracing operation performed.



var lastSelectedGraphic;

function init() {
 /**
 ** Do your init work here...
 **/
 map.graphics.enableMouseEvents();
 dojo.connect(map.graphics, "onClick", function(evt) {
  lastSelectedGraphic = evt.graphic;
  // You can do more work with the graphic here, but it is also stored for access anytime time later.
 });
}

init();


From there you can get what you need, I think.
0 Kudos