<?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: extent-change Listener? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802737#M5414</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can fire the event as you suggest in the startup function() however how do I enable&amp;nbsp;that function anytime the map extent changes&amp;nbsp;(after the startup has finished)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I need a listener on the draw event of the Feature Layer instead?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Apr 2017 21:20:52 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2017-04-14T21:20:52Z</dc:date>
    <item>
      <title>extent-change Listener?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802734#M5411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to implement a listener in a widget.js&amp;nbsp;for&amp;nbsp;extent-change events occurring in the map?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to toggle the visibility of a feature layer (that is added by other events from the widget) based upon the map's extent.&amp;nbsp; The offending workflow is that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Button on a widget panel is deactivated until a specific map extent (zoomed in) is achieved.&lt;/P&gt;&lt;P&gt;2. Upon button click, add the feature layer and set it visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with this is that there is no listener in the event that the user zooms out.&amp;nbsp; I need to be able to toggle off the visibility of that feature layer if the map extent exceeds a certain value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Apr 2017 20:30:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802734#M5411</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2017-04-14T20:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: extent-change Listener?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802735#M5412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I might be missing something in your workflow but it sounds as simple as adding a extent-change listener to the map in your widget startup then:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;startup&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&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;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;inherited&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arguments&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;own&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&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;on&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"extent-change"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; checkExtent&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;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;

checkExtent&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&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; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;evt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;lod &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;12&lt;/SPAN&gt;&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;//enable the button&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//diable the button&lt;/SPAN&gt;
&amp;nbsp; &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;&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:19:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802735#M5412</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T09:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: extent-change Listener?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802736#M5413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My task is simply to make a feature layer invisible if the current map extent exceeds a value.&amp;nbsp; Right now, that feature layer is made visible by a button click, which that button is deactivated until that extent threshold is met.&amp;nbsp; This is fine, except that I need to turn off that visibility if the user zooms out too far (because it causes performance problems).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll try to implement your example!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Apr 2017 21:09:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802736#M5413</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2017-04-14T21:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: extent-change Listener?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802737#M5414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can fire the event as you suggest in the startup function() however how do I enable&amp;nbsp;that function anytime the map extent changes&amp;nbsp;(after the startup has finished)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I need a listener on the draw event of the Feature Layer instead?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Apr 2017 21:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802737#M5414</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2017-04-14T21:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: extent-change Listener?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802738#M5415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The listener is added at widget startup but it will fire the checkExtent method any time the maps extent changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Apr 2017 21:25:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802738#M5415</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-04-14T21:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: extent-change Listener?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802739#M5416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok thanks, I must not be implementing correctly.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Apr 2017 21:29:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/extent-change-listener/m-p/802739#M5416</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2017-04-14T21:29:43Z</dc:date>
    </item>
  </channel>
</rss>

