AnsweredAssumed Answered

Programmatically set selected graphic/feature

Question asked by shoe788 on Apr 29, 2014
Latest reply on Apr 29, 2014 by shoe788
I add a graphic to the map through code and want to automatically show the infowindow without the user having to click on the graphic. With the code below it just shows an empty infowindow since nothing is selected on the map.

How can I programmatically set the selected feature or graphic?

map.graphics.add(graphic); map.centerAndZoom(graphic.geometry.getCentroid(), 6);  //What I want to do //map.setSelectedGraphic(graphic)  map.infoWindow.show(graphic.geometry.getCentroid());

Outcomes