<?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: Dropdown for layers instead of checkbox in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-for-layers-instead-of-checkbox/m-p/167860#M15569</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1. Create a radio button group. This will allow only one checked at a time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. You'll need a function, which in one way or another hides the visible layer and shows the one that was selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;func: function(layer) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; map._layers.class.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; map._layers.order.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; map._layers.family.hide();

&amp;nbsp;&amp;nbsp;&amp;nbsp; eval('map._layers.' + layer + '.show()');

}&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;calling it like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;func('class');&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Changing the "layer" for each input respectively.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's just one of many ways in which you can achieve the result. I noticed in your example you didn't give your layers an id. I never let the api assign an id to a layer. If you add an id, it's easy to go to the _layers object to impress change upon a layer. All map layers can be found here.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:44:37 GMT</pubDate>
    <dc:creator>BenFousek</dc:creator>
    <dc:date>2021-12-11T08:44:37Z</dc:date>
    <item>
      <title>Dropdown for layers instead of checkbox</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-for-layers-instead-of-checkbox/m-p/167859#M15568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been referencing the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/demos/widget/widget_legendvisible.html"&gt;Dynamic Legend Sample&lt;/A&gt;&lt;SPAN&gt; as a foundation for my web map but am having some issues making the slight change I need.&amp;nbsp; In the sample, the two layers can be selected using checkboxes - enabling both to be visible at the same time.&amp;nbsp; Instead, I want a dropdown to show the selectable layers so that only one layer can be visible at a time and the legend will match the activated layer.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I currently have: &lt;/SPAN&gt;&lt;A href="http://map.geog.ucsb.edu/CampusFlora/v2/visibleLayers.html"&gt;http://map.geog.ucsb.edu/CampusFlora/v2/visibleLayers.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I feel as if I am very close to getting this figured out but I just can't wrap my head around it - my javascript is so-so and my dojo is even less impressive..&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;Any help would be much appreciated!! &lt;/STRONG&gt;&lt;SPAN&gt; I have attached my source code to this post for future reference (.zip)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2012 16:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-for-layers-instead-of-checkbox/m-p/167859#M15568</guid>
      <dc:creator>BryanKaraffa</dc:creator>
      <dc:date>2012-09-11T16:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dropdown for layers instead of checkbox</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-for-layers-instead-of-checkbox/m-p/167860#M15569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1. Create a radio button group. This will allow only one checked at a time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. You'll need a function, which in one way or another hides the visible layer and shows the one that was selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;func: function(layer) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; map._layers.class.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; map._layers.order.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; map._layers.family.hide();

&amp;nbsp;&amp;nbsp;&amp;nbsp; eval('map._layers.' + layer + '.show()');

}&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;calling it like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;func('class');&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Changing the "layer" for each input respectively.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's just one of many ways in which you can achieve the result. I noticed in your example you didn't give your layers an id. I never let the api assign an id to a layer. If you add an id, it's easy to go to the _layers object to impress change upon a layer. All map layers can be found here.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:44:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dropdown-for-layers-instead-of-checkbox/m-p/167860#M15569</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2021-12-11T08:44:37Z</dc:date>
    </item>
  </channel>
</rss>

