<?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: How do I create a click event on a dynamically created pointGraphic? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662403#M61790</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;got it. and how I do it?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Aug 2017 16:13:18 GMT</pubDate>
    <dc:creator>MarceloAlmeida</dc:creator>
    <dc:date>2017-08-14T16:13:18Z</dc:date>
    <item>
      <title>How do I create a click event on a dynamically created pointGraphic?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662401#M61788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm developing a simple application where I have a map and for each user who logs a point is added on the map. I can not create the click event when I click on one of these points and open information about it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Aug 2017 20:27:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662401#M61788</guid>
      <dc:creator>MarceloAlmeida</dc:creator>
      <dc:date>2017-08-12T20:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a click event on a dynamically created pointGraphic?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662402#M61789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The graphic itself can't get a click event, but you have to add that graphic to a layer, which does have a &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/graphicslayer-amd.html#event-click"&gt;click event&lt;/A&gt;. Simply listen to the click event for that layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 13:44:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662402#M61789</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2017-08-14T13:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a click event on a dynamically created pointGraphic?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662403#M61790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;got it. and how I do it?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 16:13:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662403#M61790</guid>
      <dc:creator>MarceloAlmeida</dc:creator>
      <dc:date>2017-08-14T16:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a click event on a dynamically created pointGraphic?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662404#M61791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You simply add the click event to the GraphicsLayer that you're adding your points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; GLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;GraphicsLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
GLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;on&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"click"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; runClickEvent&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;runClickEvent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;evt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//do something with the event&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is another way to do this, in addition. When you construct the graphic, you can add an &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/infotemplate-amd.html" rel="nofollow noopener noreferrer" target="_blank"&gt;InfoTemplate&lt;/A&gt; (in 3.x) or &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html" rel="nofollow noopener noreferrer" target="_blank"&gt;PopupTemplate&lt;/A&gt; (in 4.x). See this &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/get-started-graphics/index.html" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt; that shows how to incorporate the attributes and PopupTemplate into a graphics that is added to a map (in this case, the line).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:00:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-create-a-click-event-on-a-dynamically/m-p/662404#M61791</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-12T04:00:30Z</dc:date>
    </item>
  </channel>
</rss>

