<?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: Changing visible legend on LayerGroup selection in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049895#M72689</link>
    <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;It looks like your Legend is limiting the layers being displayed in one of two ways. The layers that don't have a legend may have the &lt;STRONG&gt;legendEnabled&lt;/STRONG&gt; property set to &lt;STRONG&gt;false&lt;/STRONG&gt; OR the Legend widget itself has &lt;STRONG&gt;layerInfos&lt;/STRONG&gt; set that don't include the other layers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure layer.legendEnabled is true for all layers and that the Legend.layerInfos is null. If it's null the Legend widget should handle visibility of layers automatically... Let me know if that wasn't the issue...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kristian&lt;/P&gt;</description>
    <pubDate>Thu, 22 Apr 2021 00:10:16 GMT</pubDate>
    <dc:creator>KristianEkenes</dc:creator>
    <dc:date>2021-04-22T00:10:16Z</dc:date>
    <item>
      <title>Changing visible legend on LayerGroup selection</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049844#M72686</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Explanation:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm currently trying to change the visible legend when a user selects one of three grouped layers to view. These can then be interacted with in a LayerList widget. Only one layer can be selected at a time, so the legend won't clash with any others. I've tried to look up for an event that runs on selecting a different layer via the LayerList, but haven't come across anything yet. Is this possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var groupLayer = new GroupLayer({
                    title: 'Tauranga Points of Interest',
                    visible: true,
                    visibilityMode: 'exclusive',
                    layers: [LAYERS_ADDED_IN_HERE],
                    opacity: 0.7
                })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Images:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Showing the first legend - all normal." style="width: 538px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11482i4D763ACCA4B33503/image-size/large?v=v2&amp;amp;px=999" role="button" title="before.png" alt="Showing the first legend - all normal." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Showing the first legend - all normal.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Other legends not showing on layer change. The legend is currently trying to display the same 'Tsunami Evacuation Zones' layer as before." style="width: 489px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11481i2C36117D8F318D24/image-size/large?v=v2&amp;amp;px=999" role="button" title="after.png" alt="Other legends not showing on layer change. The legend is currently trying to display the same 'Tsunami Evacuation Zones' layer as before." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Other legends not showing on layer change. The legend is currently trying to display the same 'Tsunami Evacuation Zones' layer as before.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 21:30:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049844#M72686</guid>
      <dc:creator>AngusHunt</dc:creator>
      <dc:date>2021-04-21T21:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Changing visible legend on LayerGroup selection</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049875#M72687</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should work. Perhaps you are adding one of layer types that is not supported in the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html" target="_self"&gt;Legend widget&lt;/A&gt;? You can see the list of unsupported layers from the sdk doc.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-04-21 at 3.46.55 PM.png" style="width: 998px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11489i5E1269B0DF5D898C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-04-21 at 3.46.55 PM.png" alt="Screen Shot 2021-04-21 at 3.46.55 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If it is not working, could you please provide a test app? Looks like you probably already know about this sample:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have updated this sample to use legend and did not see any issues: &lt;A href="https://codepen.io/U_B_U/pen/mdRQpwM?editors=1000" target="_blank"&gt;https://codepen.io/U_B_U/pen/mdRQpwM?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 22:51:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049875#M72687</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-04-21T22:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing visible legend on LayerGroup selection</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049894#M72688</link>
      <description>&lt;P&gt;Thank you! I hadn't thought about adding the LayerGroup as the layer for the legend widget, so this was exactly what I was looking for.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 00:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049894#M72688</guid>
      <dc:creator>AngusHunt</dc:creator>
      <dc:date>2021-04-22T00:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Changing visible legend on LayerGroup selection</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049895#M72689</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;It looks like your Legend is limiting the layers being displayed in one of two ways. The layers that don't have a legend may have the &lt;STRONG&gt;legendEnabled&lt;/STRONG&gt; property set to &lt;STRONG&gt;false&lt;/STRONG&gt; OR the Legend widget itself has &lt;STRONG&gt;layerInfos&lt;/STRONG&gt; set that don't include the other layers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure layer.legendEnabled is true for all layers and that the Legend.layerInfos is null. If it's null the Legend widget should handle visibility of layers automatically... Let me know if that wasn't the issue...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 00:10:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-visible-legend-on-layergroup-selection/m-p/1049895#M72689</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2021-04-22T00:10:16Z</dc:date>
    </item>
  </channel>
</rss>

