<?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: Unable to work with the map object (this.map) in javascript in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451737#M41757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is very confusing. When checking the this and this.map object in other widgets using Chrome's debugger, I see an entirely different "this" object for ESRI's widgets versus my own. I've attached snapshots of each. My this object does not resemble ESRI's in any way. My widget though is directly from an example of ESRI's. How am I failing to get the right one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ESRIQuery.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/120453_ESRIQuery.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Mine.PNG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/120461_Mine.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Aug 2015 19:56:35 GMT</pubDate>
    <dc:creator>TylerJones3</dc:creator>
    <dc:date>2015-08-03T19:56:35Z</dc:date>
    <item>
      <title>Unable to work with the map object (this.map) in javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451734#M41754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have created a small query widget for ESRI's web app builder. However, I cannot get access the this.map object. When inspected in Chrome, it appears I'm getting some other object in the map's place instead. What am I doing wrong here, and how do I obtain the this.map object correctly?&lt;/P&gt;&lt;P&gt;The error occurs on the line where this.map.setextent occurs and the error is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;this.map.setExtent is not a function&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any attempt to work with this.map results in a similar error. I have tried comparing my code against the pre-existing ESRI widgets in the web app builder and I am not seeing any differences that would lead to this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;define([
'dojo/_base/declare',
'dojo/_base/lang',
'dojo/_base/query',
'dojo/_base/html',
'dojo/_base/array',
'dojo/_base/fx',
'dojo/promise/all',
'dojo/Deferred',
'esri/map',
'esri/graphic',
'esri/graphicsUtils',
'dojo/on',
'jimu/BaseWidget',
'dojo/dom',
'esri/tasks/query',
'esri/tasks/QueryTask',
'esri/layers/FeatureLayer',
'jimu/MapManager',

'esri/geometry/Extent',
'esri/Color',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/SimpleLineSymbol',
'esri/symbols/SimpleFillSymbol'
&amp;nbsp;&amp;nbsp; 
],
function(declare, lang, query, html, array, fx, all, Deferred, Map, Graphic, graphicsUtils, on,&amp;nbsp; BaseWidget, dom, Query, QueryTask,&amp;nbsp; FeatureLayer, MapManager,&amp;nbsp; Extent, Color, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol) { //a
&amp;nbsp; 
&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-nessearch',
&amp;nbsp;&amp;nbsp;&amp;nbsp; name: 'Search',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; startup: function() { 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log('startup');
&amp;nbsp;&amp;nbsp; }, 
&amp;nbsp; 
&amp;nbsp;&amp;nbsp; _onPointBtnClicked: function(){ //d
&amp;nbsp;&amp;nbsp;&amp;nbsp; //var layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (dom.byId("SelectType").selectedIndex) { //e
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featurelayer = &amp;lt;Layer 0&amp;gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["POLE_NO", "PNO"];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = "UPPER(POLE_NO) LIKE UPPER('%" + dom.byId("SearchValue").value + "%')";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurelayer.queryFeatures(query, function(result){&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(this.map.id); //returns an id of "map"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Problem Line:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.map.setExtent(graphicsUtils.graphicsExtent(result.features), true);&amp;nbsp; //fails here
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1.5),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Color([255, 0, 0, 0.5]));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2), new&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;&amp;nbsp;&amp;nbsp; Color([255, 0, 0, 0.5]));
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&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;&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;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp; 
&amp;nbsp; }); 
}); &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:09:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451734#M41754</guid>
      <dc:creator>TylerJones3</dc:creator>
      <dc:date>2021-12-11T20:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to work with the map object (this.map) in javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451735#M41755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You seem to be overriding the statup function without calling the &lt;CODE&gt;this.inherited(arguments)&lt;/CODE&gt;. Try adding it and let me if it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 15:43:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451735#M41755</guid>
      <dc:creator>thejuskambi</dc:creator>
      <dc:date>2015-08-03T15:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to work with the map object (this.map) in javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451736#M41756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I un-commented the line in the startup function and the problem persists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:46:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451736#M41756</guid>
      <dc:creator>TylerJones3</dc:creator>
      <dc:date>2015-08-03T16:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to work with the map object (this.map) in javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451737#M41757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is very confusing. When checking the this and this.map object in other widgets using Chrome's debugger, I see an entirely different "this" object for ESRI's widgets versus my own. I've attached snapshots of each. My this object does not resemble ESRI's in any way. My widget though is directly from an example of ESRI's. How am I failing to get the right one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ESRIQuery.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/120453_ESRIQuery.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Mine.PNG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/120461_Mine.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 19:56:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451737#M41757</guid>
      <dc:creator>TylerJones3</dc:creator>
      <dc:date>2015-08-03T19:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to work with the map object (this.map) in javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451738#M41758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see that you are trying to access the this.map from a callback.&amp;nbsp; You have to put the right scope on the callback using lang.hitch, such as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;featurelayer.queryFeatures(query, lang.hitch(this,&lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;(result){...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way, you maintain the scope of the widget.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if (&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;_onPointBtnClicked) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;is perfomed from a button on the UI, you might to add the lang.hitch as well to the registered button's on event.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 20:41:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-work-with-the-map-object-this-map-in/m-p/451738#M41758</guid>
      <dc:creator>PrevinWong1</dc:creator>
      <dc:date>2015-08-03T20:41:01Z</dc:date>
    </item>
  </channel>
</rss>

