<?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 Click on map in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/click-on-map/m-p/737498#M3919</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My task is to create a custom widget in OD where the user will click on map to choose a region. I thought of using a spatial query to fetch the id of the region and later fetch more information from a separate table. But I cannot figure out how to set the click-event on dataSource or another object representing the map.&lt;/P&gt;&lt;P&gt;Something like: &lt;/P&gt;&lt;P&gt;this.dataSourceProxy.on("click", function() {...&lt;/P&gt;&lt;P&gt;but it doesn't work.&lt;/P&gt;&lt;P&gt;Also I tryed to create MapWidgetProxy-object but didn't succeed.&lt;/P&gt;&lt;P&gt;Somebody done this before and can give a hint? I'm stuck.&lt;/P&gt;&lt;P&gt;//Janne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Nov 2015 14:21:20 GMT</pubDate>
    <dc:creator>JanneEriksson</dc:creator>
    <dc:date>2015-11-17T14:21:20Z</dc:date>
    <item>
      <title>Click on map</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/click-on-map/m-p/737498#M3919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My task is to create a custom widget in OD where the user will click on map to choose a region. I thought of using a spatial query to fetch the id of the region and later fetch more information from a separate table. But I cannot figure out how to set the click-event on dataSource or another object representing the map.&lt;/P&gt;&lt;P&gt;Something like: &lt;/P&gt;&lt;P&gt;this.dataSourceProxy.on("click", function() {...&lt;/P&gt;&lt;P&gt;but it doesn't work.&lt;/P&gt;&lt;P&gt;Also I tryed to create MapWidgetProxy-object but didn't succeed.&lt;/P&gt;&lt;P&gt;Somebody done this before and can give a hint? I'm stuck.&lt;/P&gt;&lt;P&gt;//Janne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 14:21:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/click-on-map/m-p/737498#M3919</guid>
      <dc:creator>JanneEriksson</dc:creator>
      <dc:date>2015-11-17T14:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Click on map</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/click-on-map/m-p/737499#M3920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I know, there are only &lt;A href="https://developers.arcgis.com/javascript/jsapi/mapwidgetproxy-amd.html#event-map-extent-change" rel="nofollow noopener noreferrer" target="_blank"&gt;map-extent-change&lt;/A&gt; event for map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but there are another way to go with your requirement.&lt;STRONG&gt; (May not complete)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;First,&lt;/STRONG&gt; this &lt;A href="https://github.com/Esri/dashboard-samples/blob/master/tableWidget/TableWidget.js" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt; may help you.&lt;/P&gt;&lt;P&gt;it will list attribute of select feature from selected datasource on widget when user select feature on map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in widget config. let user select &lt;SPAN class="pl-k"&gt;region layer with &lt;STRONG&gt;selected&lt;/STRONG&gt; option as &lt;STRONG&gt;DataSource.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In main widget java-script, use &lt;A href="https://developers.arcgis.com/javascript/jsapi/widgetproxy-amd.html#event-data-source-expired" rel="nofollow noopener noreferrer" target="_blank"&gt;data-source-expired&lt;/A&gt; event to capture when user select region on your map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="pl-en"&gt;dataSourceExpired&lt;/SPAN&gt;&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;function&lt;/SPAN&gt; (&lt;SPAN class="pl-smi"&gt;dataSource&lt;/SPAN&gt;, &lt;SPAN class="pl-smi"&gt;dataSourceConfig&lt;/SPAN&gt;) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //this event will be fired every time that user select region on map.
}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Second way&lt;/STRONG&gt; is create widget that let user draw some point to map then query to find region layer with that point.&lt;/P&gt;&lt;P&gt;On this way ,if you decide to query with &lt;A href="https://developers.arcgis.com/javascript/jsapi/querytask-amd.html" rel="nofollow noopener noreferrer" target="_blank"&gt;QueryTask &lt;/A&gt;​, you must fix url of service in code and may encounter with &lt;A href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing" rel="nofollow noopener noreferrer" target="_blank"&gt;CORS &lt;/A&gt;​, So you may&lt;/P&gt;&lt;P&gt;need proxy here, &lt;STRONG&gt;But I can't find any sample that work with proxy.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Well, you still can use &lt;A href="https://developers.arcgis.com/javascript/jsapi/datasourceproxy-amd.html#executequery" rel="nofollow noopener noreferrer" target="_blank"&gt;ExecuteQuery &lt;/A&gt;of datasource instead to avoid &lt;A href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing" rel="nofollow noopener noreferrer" target="_blank"&gt;CORS &lt;/A&gt;​probs.&lt;/P&gt;&lt;P&gt;But again, &lt;A href="https://developers.arcgis.com/javascript/jsapi/datasourceproxy-amd.html#executequery" rel="nofollow noopener noreferrer" target="_blank"&gt;ExecuteQuery &lt;/A&gt;with geometry's parameter work well in desktop. &lt;A _jive_internal="true" href="https://community.esri.com/thread/168066" target="_blank"&gt;In browser geometry's parameter was ignore.&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;this may be bug and you may not complete you solution in browser.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:24:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/click-on-map/m-p/737499#M3920</guid>
      <dc:creator>NoppadonHimananto</dc:creator>
      <dc:date>2021-12-12T07:24:41Z</dc:date>
    </item>
  </channel>
</rss>

