<?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: respectCurrentMapScale for Legend dijit not working? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673035#M62716</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't find any problem with the sample application, that you have posted above. The legend control seem to work as expected. I can see that the 2 layers are visible on the map and the legends for those 2 layers. And when you zoom out the layers are not visible and there is no legends as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you find not working in this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2015 13:53:05 GMT</pubDate>
    <dc:creator>thejuskambi</dc:creator>
    <dc:date>2015-05-29T13:53:05Z</dc:date>
    <item>
      <title>respectCurrentMapScale for Legend dijit not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673034#M62715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The parameters for the constructor for the Legend digit says, in relevant part, as follows:&lt;/P&gt;&lt;TABLE cellspacing="0" class="syntaxTABLE syntaxdetailstable" style="margin: 0.1em 0px 0.3em; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; border-width: 1px 1px 0px; border-style: solid; border-color: #d9d9d9; background-color: #fafafa; color: #4d4d4d;"&gt;&lt;TBODY&gt;&lt;TR style="border-bottom-style: none;"&gt;&lt;TD class="name syntaxDetailTABLE" style="border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; padding: 4px 1px 4px 5px;"&gt;&amp;lt;&lt;CODE&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean" style="color: #00629b;" rel="nofollow noopener noreferrer" target="_blank"&gt;Boolean&lt;/A&gt;&lt;/CODE&gt;&amp;gt; respectCurrentMapScale&lt;/TD&gt;&lt;TD class="syntaxDetailTABLE required" style="border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; padding: 4px 1px 4px 5px;"&gt;Optional&lt;/TD&gt;&lt;TD class="syntaxDetailTABLE description" style="border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; padding: 4px 1px 4px 5px;"&gt;When true the legend will update with every scale change and displays only the layers and sub layers that are visible in the current map scale. When false, the legend does not update on every scale change and all layers and sub layers will be displayed. The default value is true.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;TABLE cellspacing="0" class="syntaxTABLE syntaxdetailstable" style="margin: 0.1em 0px 0.3em; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; border-width: 1px 1px 0px; border-style: solid; border-color: #d9d9d9; background-color: #fafafa; color: #4d4d4d;"&gt;&lt;TBODY&gt;&lt;TR style="border-bottom-width: 1px; border-bottom-color: #ededed;"&gt;&lt;TD class="name syntaxDetailTABLE" style="border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; padding: 4px 1px 4px 5px;"&gt;&amp;lt;&lt;CODE&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean" style="color: #00629b;" rel="nofollow noopener noreferrer" target="_blank"&gt;Boolean&lt;/A&gt;&lt;/CODE&gt;&amp;gt; autoUpdate&lt;/TD&gt;&lt;TD class="syntaxDetailTABLE required" style="border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; padding: 4px 1px 4px 5px;"&gt;Optional&lt;/TD&gt;&lt;TD class="syntaxDetailTABLE description" style="border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; padding: 4px 1px 4px 5px;"&gt;When false, the legend will not automatically update if the map changes scale or when layers are added are removed from the map. Call refresh to force a legend update. The default value is true.&amp;nbsp; &lt;EM&gt;Added at v3.10&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following constructor for a legend digit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var legend = new Legend({
&amp;nbsp; map: map,
&amp;nbsp; autoUpdate: true,
&amp;nbsp; layerInfos: legendLayers
},'LegendDiv');&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Legend appears. And, the title of the Legend digit autoupdates as I switch between viewable layers (I have four layers, only one is viewable at once.) However, the contents of the legend digit do not change, no matter whether I switch between layers, pan or zoom on the map, nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would think there's some bug in my code. However, &lt;A href="https://developers.arcgis.com/javascript/jssamples/widget_legend.html" rel="nofollow noopener noreferrer" target="_blank"&gt;this sample code&lt;/A&gt; on the Esri website doesn't work either. You can &lt;A href="http://developers.arcgis.com/javascript/samples/widget_legend/" rel="nofollow noopener noreferrer" target="_blank"&gt;try the live version&lt;/A&gt;. The legend constructor code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var legendDijit = new Legend({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map: map,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerInfos: layerInfo
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, "legendDiv");
legendDijit.startup();&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;The &lt;SPAN&gt;front&lt;/SPAN&gt; of the sample code page says&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;&lt;SPAN style="color: #303030;"&gt; "&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; background-color: #fefefe;"&gt;You can also set the &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;respectCurrentMapScale&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; background-color: #fefefe;"&gt; parameter to true if you want the legend to only display layers that are visible in the current map scale.&lt;/SPAN&gt;&lt;SPAN style="color: #303030;"&gt;" That shouldn't be necessary because &lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN style="color: #303030; font-family: 'Courier New';"&gt;respectCurrentMapScale &lt;/SPAN&gt;&lt;SPAN style="color: #303030; font-family: arial, helvetica, sans-serif;"&gt;should default to true. However, even if you change the code in the sandbox to explicitly set it to true, it still doesn't automatically update based on the map scale.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;SPAN&gt;&lt;SPAN style="color: #303030; font-family: arial, helvetica, sans-serif;"&gt;What's going on here? Is it broken? Am I fundamentally misunderstanding something? I'm still pretty new to using the ArcGIS Javascript API, but it's driving me a bit bonkers.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;SPAN&gt;&lt;SPAN style="color: #303030; font-family: arial, helvetica, sans-serif;"&gt;Thanks.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;SPAN&gt;&lt;SPAN style="color: #303030; font-family: arial, helvetica, sans-serif;"&gt; - geoff&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673034#M62715</guid>
      <dc:creator>deleted-user-m6DuRVNpNiGp</dc:creator>
      <dc:date>2021-12-12T04:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: respectCurrentMapScale for Legend dijit not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673035#M62716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't find any problem with the sample application, that you have posted above. The legend control seem to work as expected. I can see that the 2 layers are visible on the map and the legends for those 2 layers. And when you zoom out the layers are not visible and there is no legends as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you find not working in this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 13:53:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673035#M62716</guid>
      <dc:creator>thejuskambi</dc:creator>
      <dc:date>2015-05-29T13:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: respectCurrentMapScale for Legend dijit not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673036#M62717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, your note pointed out that I was misunderstanding how the autoupdate functioned. From reading the description I assumed that by only showing items "that are visible in the current map scale," the legend would change not only as visibility changed by zooming in or out, but also by panning onto an area of the map with no features. Obviously, reading it a bit more closely and in the light of morning, that's not what it means by "current map scale," and it does work as promised when zooming in and out. Thanks for the comment/answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 13:57:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/673036#M62717</guid>
      <dc:creator>deleted-user-m6DuRVNpNiGp</dc:creator>
      <dc:date>2015-05-29T13:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: respectCurrentMapScale for Legend dijit not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/1139937#M76229</link>
      <description>&lt;P&gt;Is there a way to only show items in the legend that are displayed in the map? For example, I have 4 symbols for a feature. If I zoom in and only 2 symbols are visible can the legend update to show only those 2 symbols?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 17:10:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/respectcurrentmapscale-for-legend-dijit-not/m-p/1139937#M76229</guid>
      <dc:creator>RobertKirkwood</dc:creator>
      <dc:date>2022-02-02T17:10:08Z</dc:date>
    </item>
  </channel>
</rss>

