Display information window on click event of a new graphic

374
1
05-01-2019 07:37 AM
BrianRoscher
New Contributor III

So I have a program where I create the following variables:

var point = new Point();

var markerSymbol = new PictureMarkerSymbol(); 

var graphic = new Graphic(point, markerSymbol);

I am able to display this new graphic on my map no problem anywhere I want but is it possible to make a click event on my graphic that will display an information window.  I was thinking that it would be possible using dojo/on but I could not figure out how to use dojo/on to attach a click event to the graphic.

Thanks...

0 Kudos
1 Reply
by Anonymous User
Not applicable

Hi Brian,

You don't need to trigger the click event to open the infowindow.

You may want to try this code snippet.

First you need to have a graphiclayer and add graphiclayer into the map.

Also Create the infotemplate.

and Add your newly created graphic into that graphic layer.

this.map.centerAt(point);

this.map.infoWindow.setFeatures([graphic]);

this.map.infoWindow.show(point);

The concept is derived from that help

Show an info window | ArcGIS API for JavaScript 3.29 

0 Kudos