<?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 LayerList widget list to order changes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276888#M80811</link>
    <description>&lt;P&gt;When setting up LayerList widget I've set&amp;nbsp;&lt;SPAN&gt;selectionEnabled to&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;true, which allows the layers to be reordered including placing layers as sublayers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What i want to be able to do is listen for any event that will tell me the order/hierarchy has changed and what the new structure looks like.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is no documentation explaining if there is a event to even listen for.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Apr 2023 11:25:08 GMT</pubDate>
    <dc:creator>Aeseir</dc:creator>
    <dc:date>2023-04-10T11:25:08Z</dc:date>
    <item>
      <title>LayerList widget list to order changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276888#M80811</link>
      <description>&lt;P&gt;When setting up LayerList widget I've set&amp;nbsp;&lt;SPAN&gt;selectionEnabled to&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;true, which allows the layers to be reordered including placing layers as sublayers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What i want to be able to do is listen for any event that will tell me the order/hierarchy has changed and what the new structure looks like.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is no documentation explaining if there is a event to even listen for.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 11:25:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276888#M80811</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2023-04-10T11:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList widget list to order changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276938#M80812</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/546199"&gt;@Aeseir&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P data-unlink="true"&gt;Thanks for the question.&amp;nbsp; There are probably a few different ways to go about this, but I'd suggest using &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html" target="_self"&gt;reactiveUtils&lt;/A&gt;&amp;nbsp; to watch the map &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#allLayers" target="_self"&gt;allLayers&lt;/A&gt; property as shown in this sample.&amp;nbsp; This sample shows how watch for&amp;nbsp;&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html" target="_self"&gt;Collection&lt;/A&gt;&amp;nbsp;changes.&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/watch-for-changes-reactiveutils/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/watch-for-changes-reactiveutils/&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Use reactiveUtils to check when a Collection has changed
reactiveUtils.watch(
    () =&amp;gt; view.map.allLayers.every((layer) =&amp;gt; layer.visible),
    (allVisible) =&amp;gt; {
        console.log(`All layers are visible = ${allVisible}`)
    });&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 10 Apr 2023 14:33:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276938#M80812</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-04-10T14:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList widget list to order changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276966#M80814</link>
      <description>&lt;P&gt;Just to add on on the answer that was provided by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/507049"&gt;@Sage_Wall&lt;/a&gt;, you can also add reactiveUtils to all the operationalLayers of the LayerList widget. You can maybe store the initial arrange of the layers somewhere and compare every time it changes. The function below will list down all the layers ID&amp;nbsp; when operational layers are modified.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.watch(
          () =&amp;gt; layerList.operationalItems.map(item =&amp;gt; item.layer.id),
          (ids) =&amp;gt; {
            console.log(`FeatureLayer IDs ${ids}`);
          });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 15:48:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1276966#M80814</guid>
      <dc:creator>RamaniGanason</dc:creator>
      <dc:date>2023-04-10T15:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList widget list to order changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1277212#M80821</link>
      <description>&lt;P&gt;This doesn't solve my challenge. Sure if i show/hide the layer, but I want to see hierarchy that is displayed in the layerlist.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 10:06:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1277212#M80821</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2023-04-11T10:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList widget list to order changes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1277214#M80822</link>
      <description>&lt;P&gt;This is closer to the potential solution. Doesn't quiet work tho if you move a layer as a sublayer, in which case you need to export entire layer tree.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 10:10:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-widget-list-to-order-changes/m-p/1277214#M80822</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2023-04-11T10:10:48Z</dc:date>
    </item>
  </channel>
</rss>

