<?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: Map click events and related WAB documentation in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712963#M18729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This helped me a good bit.&amp;nbsp; Thanks for sharing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Sep 2017 17:14:43 GMT</pubDate>
    <dc:creator>AndrewDavis5</dc:creator>
    <dc:date>2017-09-01T17:14:43Z</dc:date>
    <item>
      <title>Map click events and related WAB documentation</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712960#M18726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i'm just kicking off my first WAB widget and immediately running into an issue trying to set map click handlers when the widget is opened. Looking through the esri coordinate widget i found this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;this.own(on(this.map, "click", lang.hitch(this, this.onMapClick)));&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I just can't get it to register the event, here's my full code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;define([
&amp;nbsp; 'dojo/_base/declare', 
&amp;nbsp; 'jimu/BaseWidget',
&amp;nbsp; 'esri/geometry/Point',
&amp;nbsp; 'esri/SpatialReference'
],
function(declare, BaseWidget) {
&amp;nbsp; //To create a widget, you need to derive from BaseWidget.
&amp;nbsp; return declare([BaseWidget], {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Custom widget code goes here 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; baseClass: 'jimu-widget-customwidget',


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startup: function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);
&amp;nbsp; //this.mapIdNode.innerHTML = 'map id:' + String(this.map.getScale());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; onOpen: function(){
&amp;nbsp; this.own(on(this.map, "click", lang.hitch(this, this.onMapClick)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; onMapClick: function(event) {
&amp;nbsp; window.alert('map click');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.mapIdNode.innerHTML = 'map id:' + String(event.mapPoint.x);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; });
});&amp;nbsp; &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm very confused why this isn't working. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also does anyone know where i can find better documentation specific to the WAB? i also found this in the measurement widget and trying to work out the differences is giving me a headache, there seems to be a lot of methods/functions not found in the JSAPI and it would be nice to know what they are.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if (this.map &amp;amp;&amp;amp; this.map.webMapResponse) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var handler = this.map.webMapResponse.clickEventHandle;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (handler) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handler.remove();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.map.webMapResponse.clickEventHandle = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:32:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712960#M18726</guid>
      <dc:creator>HessCorporation</dc:creator>
      <dc:date>2021-12-12T06:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Map click events and related WAB documentation</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712961#M18727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Managed to answer my own question, code is below for future reference, the issue was that i wasn't defining dojo.lang.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;define([
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dojo/_base/declare',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dijit/_WidgetsInTemplateMixin',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'jimu/BaseWidget',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dojo/_base/lang',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dojo/on',
&amp;nbsp; 'dojo/dom',
&amp;nbsp; 'dojo/domReady',
&amp;nbsp; 'esri/tasks/query',
&amp;nbsp; 'esri/tasks/QueryTask'
],
function(
&amp;nbsp;&amp;nbsp;&amp;nbsp; declare,
&amp;nbsp;&amp;nbsp;&amp;nbsp; _WidgetsInTemplateMixin,
&amp;nbsp;&amp;nbsp;&amp;nbsp; BaseWidget,
&amp;nbsp;&amp;nbsp;&amp;nbsp; lang,
&amp;nbsp;&amp;nbsp;&amp;nbsp; on,
&amp;nbsp; dom,
&amp;nbsp; domReady,
&amp;nbsp; Query,
&amp;nbsp; QueryTask
&amp;nbsp; ) {
&amp;nbsp; //To create a widget, you need to derive from BaseWidget.
&amp;nbsp; return declare([BaseWidget, _WidgetsInTemplateMixin], {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Custom widget code goes here 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; baseClass: 'jimu-widget-editor',
&amp;nbsp; name: 'Editor',

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startup: function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; onOpen: function(){
&amp;nbsp; this.own(on(this.map, "click", lang.hitch(this, this.onMapClick)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; onMapClick: function(event) {
&amp;nbsp; this.mapIdNode.innerHTML = String(event.mapPoint.x);
&amp;nbsp; var queryTask = new QueryTask('*Service URL*');
&amp;nbsp; var query = new Query();
&amp;nbsp; query.returnGeometry = true;
&amp;nbsp; query.outFields = ['*'];

&amp;nbsp; query.geometry = event.mapPoint;
&amp;nbsp; queryTask.execute(query, lang.hitch(this, this.showResults));
&amp;nbsp; },

&amp;nbsp; showResults: function(results) {
&amp;nbsp; var resultItems = [];
&amp;nbsp; var resultCount = results.features.length;
&amp;nbsp; for (var i = 0; i &amp;lt; resultCount; i++) {
&amp;nbsp; var featureAttributes = results.features&lt;I&gt;.attributes;&lt;/I&gt;
&amp;nbsp; this.featName.innerHTML = featureAttributes.NAME;
&amp;nbsp; //window.alert(featureAttributes.NAME);
&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp;&amp;nbsp; });
});&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:32:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712961#M18727</guid>
      <dc:creator>RichardThompson</dc:creator>
      <dc:date>2021-12-12T06:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Map click events and related WAB documentation</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712962#M18728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this. It helped me too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2016 15:07:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712962#M18728</guid>
      <dc:creator>CarlosSousaFerreira</dc:creator>
      <dc:date>2016-09-07T15:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Map click events and related WAB documentation</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712963#M18729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This helped me a good bit.&amp;nbsp; Thanks for sharing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 17:14:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712963#M18729</guid>
      <dc:creator>AndrewDavis5</dc:creator>
      <dc:date>2017-09-01T17:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Map click events and related WAB documentation</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712964#M18730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Additional link that may be useful.&amp;nbsp; I found this page first, then the link below to show removing the event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/214607-how-to-turn-tool-for-mapclick-event-on-and-off"&gt;https://community.esri.com/thread/214607-how-to-turn-tool-for-mapclick-event-on-and-off&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2019 17:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/map-click-events-and-related-wab-documentation/m-p/712964#M18730</guid>
      <dc:creator>TimDine</dc:creator>
      <dc:date>2019-05-03T17:09:54Z</dc:date>
    </item>
  </channel>
</rss>

