<?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 load event in 4.3? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708612#M65920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to run some code after a LayerList has loaded, in version 4.3. &amp;nbsp;In 3.2, there is a &lt;STRONG&gt;load&lt;/STRONG&gt; event, however 4.3 doesn't seem to have this. &amp;nbsp;LayerList doesn't seem to implement promises, so &lt;STRONG&gt;.then()&lt;/STRONG&gt; is not available. &amp;nbsp;And I couldn't find a property I can &lt;STRONG&gt;watch&lt;/STRONG&gt;. &amp;nbsp;Is there a way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jun 2017 20:46:05 GMT</pubDate>
    <dc:creator>JimNoel</dc:creator>
    <dc:date>2017-06-26T20:46:05Z</dc:date>
    <item>
      <title>LayerList load event in 4.3?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708612#M65920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to run some code after a LayerList has loaded, in version 4.3. &amp;nbsp;In 3.2, there is a &lt;STRONG&gt;load&lt;/STRONG&gt; event, however 4.3 doesn't seem to have this. &amp;nbsp;LayerList doesn't seem to implement promises, so &lt;STRONG&gt;.then()&lt;/STRONG&gt; is not available. &amp;nbsp;And I couldn't find a property I can &lt;STRONG&gt;watch&lt;/STRONG&gt;. &amp;nbsp;Is there a way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2017 20:46:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708612#M65920</guid>
      <dc:creator>JimNoel</dc:creator>
      <dc:date>2017-06-26T20:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList load event in 4.3?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708613#M65921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no load event for LayerList widget. You can wait for the view to be loaded by calling view.then.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jul 2017 20:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708613#M65921</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2017-07-07T20:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList load event in 4.3?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708614#M65922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Undral.&amp;nbsp; Actually, I had already tried using view.then.&amp;nbsp; Unfortunately, the LayerList hasn't actually loaded yet at the time of the view load event, or at least it hasn't updated with all the layer info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For some context, what I'm trying to do is to have all the nodes of the LayerList expanded at startup.&amp;nbsp; I'm using the following function to do this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;function &lt;/SPAN&gt;&lt;SPAN style="font-style: italic;"&gt;layerList_ExpandAll&lt;/SPAN&gt;(expand) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;var &lt;/SPAN&gt;&lt;SPAN style="color: #458383;"&gt;ctSpans &lt;/SPAN&gt;= &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;document&lt;/SPAN&gt;.&lt;SPAN style="color: #7a7a43;"&gt;getElementsByClassName&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"esri-layer-list__child-toggle"&lt;/SPAN&gt;);
&lt;SPAN style="color: #808080; font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;var &lt;/SPAN&gt;&lt;SPAN style="color: #458383;"&gt;i &lt;/SPAN&gt;= &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;; &lt;SPAN style="color: #458383;"&gt;i &lt;/SPAN&gt;&amp;lt; &lt;SPAN style="color: #458383;"&gt;ctSpans&lt;/SPAN&gt;.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;length&lt;/SPAN&gt;; &lt;SPAN style="color: #458383;"&gt;i&lt;/SPAN&gt;++)
&lt;SPAN style="color: #808080; font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #458383;"&gt;ctSpans&lt;/SPAN&gt;[&lt;SPAN style="color: #458383;"&gt;i&lt;/SPAN&gt;][&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"data-item"&lt;/SPAN&gt;].&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;open &lt;/SPAN&gt;= expand;
&lt;SPAN style="color: #808080; font-style: italic;"&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;P&gt;When the LayerList is fully loaded, there will be at least one item in ctSpans.&amp;nbsp; However, when called in view.then, these elements haven't been created yet, so the function doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a temporary fix, I'm applying the function on extent changes.&amp;nbsp; This works fine, but the user has to pan or zoom before the LayerList expands.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:45:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708614#M65922</guid>
      <dc:creator>JimNoel</dc:creator>
      <dc:date>2021-12-12T05:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: LayerList load event in 4.3?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708615#M65923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Instead of the extent change you should use the layer view updating property:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;//lyr is a specific layer in your map&lt;/SPAN&gt;
view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;whenLayerView&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&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;lyrView&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp; watchUtils&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;whenFalseOnce&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrView&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"updating"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&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;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//now your layer is done drawing oin the view for the first time and your LayerList&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//should be ready to go by this point.&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="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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:45:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/layerlist-load-event-in-4-3/m-p/708615#M65923</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T05:45:53Z</dc:date>
    </item>
  </channel>
</rss>

