<?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: ArcGIS LayerList change layer on refresh in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-layerlist-change-layer-on-refresh/m-p/451712#M41753</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think the refresh method takes any arguments.&amp;nbsp; Rather redefine the widget.layers property to your new layers array and then call the refresh method.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function refresh(curLayer){
&amp;nbsp;&amp;nbsp; widget.layers = [ {layer: curLayer } ];
&amp;nbsp;&amp;nbsp; widget.refresh();
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:09:22 GMT</pubDate>
    <dc:creator>FC_Basson</dc:creator>
    <dc:date>2021-12-11T20:09:22Z</dc:date>
    <item>
      <title>ArcGIS LayerList change layer on refresh</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-layerlist-change-layer-on-refresh/m-p/451711#M41752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE style="border: 0px; font-size: 13px; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;"&gt;&lt;TBODY&gt;&lt;TR style="border: 0px;"&gt;&lt;TD class="votecell" style="padding: 0 15px 0 0; border: 0px;"&gt;&lt;P class="vote" style="text-align: center;"&gt;&lt;A class="vote-up-off" style="margin: 0 auto 2px; font-size: 1px; color: #0077cc; text-indent: -9999em; background-position: no-repeat;" title="This question shows research effort; it is useful and clear" target="_blank"&gt;up vote&lt;/A&gt;&lt;SPAN class="vote-count-post" style="margin: 8px 0; font-size: 20px; color: #6a737c;"&gt;0&lt;/SPAN&gt;&lt;A class="vote-down-off" style="margin: 0 auto 10px; font-size: 1px; color: #0077cc; text-indent: -9999em; background-position: no-repeat;" title="This question does not show any research effort; it is unclear or not useful" target="_blank"&gt;down vote&lt;/A&gt;&lt;A class="star-off" href="http://stackoverflow.com/questions/37503902/arcgis-layerlist-change-layer-on-refresh" style="margin: 0 auto 2px; font-size: 1px; color: #0077cc; text-indent: -9999em; background-position: no-repeat;" title="Click to mark as favorite question (click again to undo)" rel="nofollow noopener noreferrer" target="_blank"&gt;favorite&lt;/A&gt;&lt;/P&gt;&lt;DIV class="favoritecount"&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;TD class="postcell" style="border: 0px;"&gt;&lt;P class="post-text" style="margin: 0 0 5px; font-size: 15px;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em;"&gt;Basically I have three dynamic map services and I have added all of them onto the map. Everytime I made a selection, I want the layers in my layerlist widget to change and the options displayed will be altered based on what layers are available in each of my map service.&lt;/P&gt;&lt;P style="margin-bottom: 1em;"&gt;The layer list widget I am using is this: &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/layerlist-amd.html" rel="nofollow noopener noreferrer" style="color: #005999;" target="_blank"&gt;https://developers.arcgis.com/javascript/3/jsapi/layerlist-amd.html&lt;/A&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em;"&gt;Currently, I call the following function everytime a different map service is selected:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="kwd" style="color: #101094;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; refresh&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt;curLayer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;){&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; 
widget&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt;refresh&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;({&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; map&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layers&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;[{&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; layer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; curLayer
 &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;}]
&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #303336;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #7d2727;"&gt;'layerlist'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #303336;"&gt;
};
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin-bottom: 1em;"&gt;However, nothing has changed. Any suggestions?&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:09:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-layerlist-change-layer-on-refresh/m-p/451711#M41752</guid>
      <dc:creator>HeatherSha</dc:creator>
      <dc:date>2021-12-11T20:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS LayerList change layer on refresh</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-layerlist-change-layer-on-refresh/m-p/451712#M41753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think the refresh method takes any arguments.&amp;nbsp; Rather redefine the widget.layers property to your new layers array and then call the refresh method.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function refresh(curLayer){
&amp;nbsp;&amp;nbsp; widget.layers = [ {layer: curLayer } ];
&amp;nbsp;&amp;nbsp; widget.refresh();
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-layerlist-change-layer-on-refresh/m-p/451712#M41753</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2021-12-11T20:09:22Z</dc:date>
    </item>
  </channel>
</rss>

