AnsweredAssumed Answered

Selecting graphics programmatically

Question asked by areiter on Nov 7, 2013
Latest reply on Nov 7, 2013 by schlot
I understand this isn't exactly a rare question here, but I still haven't found an ideal solution.  What I want to do is have exactly the same behavior when I select a graphic on the map as when I select it from a list outside the map, ie the InfoWindow pops up using the InfoTemplate/attributes of the graphic I've specified and the graphic gets the "selected" icon (the blue square).

It isn't too difficult to hack around this:
//gfx is a graphic that comes from elsewhere...
map.infoWindow.setTitle(gfx.getTitle());
map.infoWindow.setContent(gfx.getContent());
map.infoWindow.show(gfx.geometry);


However, this doesn't produce the same behavior as a click.  The map's InfoWindow "onShow" event fires but the event has no graphic attached, and if you had a graphic selected already, the blue selected icon on the map stays where it is and doesn't attach to the new graphic.

Is there something I missing, or is the best way to simply stop using InfoTemplates entirely and rely on infoWindow.show?

Outcomes