<?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: Get layer name in layerList widget in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108434#M74990</link>
    <description>&lt;P&gt;The LayerList has &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#selectedItems" target="_self"&gt;selectedItems&lt;/A&gt; Collection you can watch for change events. The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-ListItem.html" target="_self"&gt;Item&lt;/A&gt; has a layer property you can reference.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Oct 2021 15:16:27 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2021-10-18T15:16:27Z</dc:date>
    <item>
      <title>Get layer name in layerList widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108427#M74989</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;i just tried to add some actions to my layerlist widget. (increase/decrease opacity, zoom to extent)&lt;/P&gt;&lt;P&gt;In &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-layerlist-actions" target="_self"&gt;this example&lt;/A&gt; they called a special layer by name but i want to use this actions on each layer in my map.&lt;/P&gt;&lt;P&gt;Isn't there an easy way to define the selected Layer in the layerList widget?&lt;/P&gt;&lt;P&gt;I didn't find anything easy like "var layer = layerlist.selectedLayer"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 14:46:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108427#M74989</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-10-18T14:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get layer name in layerList widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108434#M74990</link>
      <description>&lt;P&gt;The LayerList has &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#selectedItems" target="_self"&gt;selectedItems&lt;/A&gt; Collection you can watch for change events. The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-ListItem.html" target="_self"&gt;Item&lt;/A&gt; has a layer property you can reference.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 15:16:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108434#M74990</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-10-18T15:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get layer name in layerList widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108463#M74992</link>
      <description>&lt;P&gt;Thanks for your reply &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with the following snippet;&lt;/P&gt;&lt;P&gt;layerList.on("trigger-action", (event) =&amp;gt; {&lt;BR /&gt;layerList.selectedItems.watch("ListItem",layer =&amp;gt;{&lt;BR /&gt;console.log("do something");&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the console.log doesn't return anything.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 16:04:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108463#M74992</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-10-18T16:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get layer name in layerList widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108471#M74993</link>
      <description>&lt;P&gt;selectedItems is a Collection, so you can use ".on()" to listen for events, like this sample.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/zYzXrEy?editors=0010" target="_blank"&gt;https://codepen.io/odoe/pen/zYzXrEy?editors=0010&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 16:23:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108471#M74993</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-10-18T16:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get layer name in layerList widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108739#M75007</link>
      <description>&lt;P&gt;Thanks again for your fast reply &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Solution that works for me is;&lt;/P&gt;&lt;P&gt;layerList.on("trigger-action", (event) =&amp;gt; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var activeLayer = event.item.layer.name;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; console.log(activeLayer);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;Defining the 'name" in the layer definition...&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 08:41:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1108739#M75007</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-10-19T08:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get layer name in layerList widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1139245#M76185</link>
      <description>&lt;P&gt;I was looking to do the same thing, but your excerpt didnt work for me. Would you be able to provide the exact syntax you used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 01:59:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-layer-name-in-layerlist-widget/m-p/1139245#M76185</guid>
      <dc:creator>MichaelKarikari1</dc:creator>
      <dc:date>2022-02-01T01:59:03Z</dc:date>
    </item>
  </channel>
</rss>

