Is it possible to set the LayerList widget to only show one layer at a time in 4.x?
Alex,
See this sample. It uses a group layer to set the layers to exclusive mode.
<SPAN class="keyword token">var</SPAN> demographicGroupLayer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GroupLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN> title<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"US Demographics"</SPAN><SPAN class="punctuation token">,</SPAN> visible<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">,</SPAN> visibilityMode<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"exclusive"</SPAN><SPAN class="punctuation token">,</SPAN> layers<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN>USALayer<SPAN class="punctuation token">,</SPAN> censusLayer<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> opacity<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">0.75</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=widgets-layerlist-actions
This could work! Thanks! Do you know if it's possible to default the layer group to be open so it displays all the child layers when the map loads?
4.x. Sorry, updated the original question.
Is this a 3.x or 4.x API question?
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.