<?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: Updating/Recentering a Map - JS API 3.28 in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852214#M10982</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i tried having the map be declared and created at startup, and it seems to work as the extent changes at every click of the button. Now there's a new issue, however. Upon the second click, i believe the layers added to the map are out of order, as one of them is drawn over the other (should be the other way around). That and the graphics aren't redrawn. But that i believe is caused by it being inside the on "load" function (i had it placed in here as i'd get an error if it wasn't)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jul 2019 17:57:04 GMT</pubDate>
    <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
    <dc:date>2019-07-29T17:57:04Z</dc:date>
    <item>
      <title>Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852207#M10975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a widget that creates a and populates a map after a queryTask returns its results. My problem is when i perform the query a second time with a different result, the map won't recenter nor draw the graphics around the polygon (the result).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I create the map like this:&lt;/P&gt;&lt;P&gt;newExtent = new Extent(results.features[0].geometry.getExtent());&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;fichaMap = new Map("mapDiv", {&lt;BR /&gt;&amp;nbsp;extent: newExtent,&lt;BR /&gt;&amp;nbsp;showLabels: true,&lt;BR /&gt;&amp;nbsp;logo: false,&lt;BR /&gt;&amp;nbsp;zoom: 16,&lt;BR /&gt;&amp;nbsp;slider: false&lt;BR /&gt;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that i create a mapPoint and have a centerAt() inside a on("click") function to recenter the map to the new result as it doesn't do it automatically. Is there anything i can do to make this onCenter work? I can provide more info if needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: Pastebin with all the code in it(service urls removed for security purposes): &lt;A class="link-titled" href="https://pastebin.com/EvkA3NH4" title="https://pastebin.com/EvkA3NH4"&gt;[JavaScript] widget.js - Pastebin.com&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 16:49:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852207#M10975</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-29T16:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852208#M10976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matheus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Why are you creating a new map object?.. In your widget if you want to set the maps extent you just use:&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;setExtent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;newExtent&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:12:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852208#M10976</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-07-29T17:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852209#M10977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I unfortunately need a new map object, as this widget generates a report (to later be printed) in a separate modal. The map serves the purpose of illustrating the location of whatever the query result is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:17:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852209#M10977</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-29T17:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852210#M10978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are there any errors in the web console when you perform the query a second time?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:23:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852210#M10978</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-07-29T17:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852211#M10979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope, no errors. Here it is in a pastebin: &lt;A class="link-titled" href="https://pastebin.com/EvkA3NH4" title="https://pastebin.com/EvkA3NH4"&gt;[JavaScript] widget.js - Pastebin.com&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:29:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852211#M10979</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-29T17:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852212#M10980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Matheus,&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp;I think you should be creating the new Map once (at startup) and not each time you click the print button, unless you are going to use domConstruct.destroy on the mapDiv.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:44:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852212#M10980</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-07-29T17:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852213#M10981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could i use destroy to "remake" the map on every click of the button?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:48:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852213#M10981</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-29T17:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852214#M10982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i tried having the map be declared and created at startup, and it seems to work as the extent changes at every click of the button. Now there's a new issue, however. Upon the second click, i believe the layers added to the map are out of order, as one of them is drawn over the other (should be the other way around). That and the graphics aren't redrawn. But that i believe is caused by it being inside the on "load" function (i had it placed in here as i'd get an error if it wasn't)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:57:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852214#M10982</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-29T17:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852215#M10983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matheus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;So now you will have to re-evaluate your work flow. As it stands you are adding featurelayers to the map each time the button is clicked. But now that the map is already created you need to see if that featurelayer is already part of the map and if it is then do not add it again. Anything you had in the map load event will only get called one time when the map initially loads so you might need to move those in your workflow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 18:31:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852215#M10983</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-07-29T18:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Updating/Recentering a Map - JS API 3.28</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852216#M10984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got the map to be remade at every click by just calling .removeAllLayers(); before any layers are added. That way the map will be "remade" on the second and consecutive presses of the button.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 18:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/updating-recentering-a-map-js-api-3-28/m-p/852216#M10984</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-29T18:58:46Z</dc:date>
    </item>
  </channel>
</rss>

