<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Graphic onClick event handler in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155752#M14496</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try listening to the GraphicsLayer "onClick" event&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/graphicslayer.htm#onClick"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/graphicslayer.htm#onClick&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The returned event object should have the graphic that got clicked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Aug 2012 22:29:29 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2012-08-10T22:29:29Z</dc:date>
    <item>
      <title>Graphic onClick event handler</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155751#M14495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This seems like a very simple request, I want to add an individual listener for several graphics(unknown number) that are displayed on the same graphics layer.&amp;nbsp; I'm pretty new to the ESRI javascript api, but you would think that this would be simple.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To start, I am querying a rest api that returns the coordinates of the graphics I want to display.&amp;nbsp; I have no problem displaying the graphic, but can't add a listener.&amp;nbsp; Here's what I have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;polygon[id] = new esri.geometry.Polygon(new esri.SpatialReference({wkid:4326})); polygon[id].addRing(ring); var symbol = new esri.symbol.SimpleFillSymbol(); footprint[id] = new esri.Graphic(polygon[id], symbol); footprintLayer.add(footprint[id]);&amp;nbsp; dojo.connect(footprint[id], "onClick", function(evt) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert('It works'); });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is currently showing a polygon, but will be replaced with a geo-referenced image.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I must be missing something, because this is very easy to do with the flex api. Any help would be appreciated!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 20:59:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155751#M14495</guid>
      <dc:creator>SethEllingson</dc:creator>
      <dc:date>2012-08-10T20:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Graphic onClick event handler</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155752#M14496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try listening to the GraphicsLayer "onClick" event&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/graphicslayer.htm#onClick"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/graphicslayer.htm#onClick&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The returned event object should have the graphic that got clicked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 22:29:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155752#M14496</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2012-08-10T22:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Graphic onClick event handler</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155753#M14497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply, but when I add a listener to the graphic layer, the returned event object doesn't specify which graphic was clicked.&amp;nbsp; It does return an array of all the graphics on the layer, but that doesn't help very much.&amp;nbsp; Is there another way to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 18:10:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155753#M14497</guid>
      <dc:creator>SethEllingson</dc:creator>
      <dc:date>2012-08-13T18:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Graphic onClick event handler</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155754#M14498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The event object passed to a graphics layer's onClick handler has a property called graphic you can use to access the graphic that was clicked. Here's an example:&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://jsfiddle.net/TXHXc/" rel="nofollow" target="_blank"&gt;http://jsfiddle.net/TXHXc/&lt;/A&gt;&lt;SPAN&gt; (clicking a graphic logs a message to the browser's console)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's also a blog post discussing finding graphics under a mouse click:&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://blogs.esri.com/esri/arcgis/2010/02/08/find-graphics-under-a-mouse-click-with-the-arcgis-api-for-javascript/" rel="nofollow" target="_blank"&gt;http://blogs.esri.com/esri/arcgis/2010/02/08/find-graphics-under-a-mouse-click-with-the-arcgis-api-for-javascript/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 18:29:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155754#M14498</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-08-13T18:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Graphic onClick event handler</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155755#M14499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for those links, they helped me solve the problem.&amp;nbsp; For some reason, Firebug is not showing all of the attributes of the click event object so I was not aware of the 'graphic' attribute.&amp;nbsp; These links showed me what I needed to know, thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 18:50:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/graphic-onclick-event-handler/m-p/155755#M14499</guid>
      <dc:creator>SethEllingson</dc:creator>
      <dc:date>2012-08-13T18:50:59Z</dc:date>
    </item>
  </channel>
</rss>

