<?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 Where should I place the layerList.multipleSelectionEnabled=false; property in ArcGIS Maps SDK for JavaScript 4.x? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1247924#M79891</link>
    <description>&lt;P&gt;I am trying to create a web application that allows users to explore layers related to climate safe neighborhoods. When I asked some of my colleagues to try an out of the box template from ArcGIS Online, they had difficulty understanding that they need to turn off layers above the layer they want to see to view it. I want to code a map that only allows users to select one layer at a time, so this doesn't happen, and I also want the legends to show with the layer list item. There's a solution on Stack Overflow that allows only one layer selection at a time that I found on this site, but it doesn't also show the legend, and it uses an older version of the API which I am not familiar with &lt;A href="https://stackoverflow.com/questions/43457902/single-layer-visible-in-layerlist-widget-arcgis-javascript" target="_blank"&gt;Single layer visible in LayerList widget (ArcGIS JavaScript)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Most of my data is Choropleth, so the layers cover each other even when I lower their opacity. I located an html file I created from my web mapping course in college, and I've been trying to modify it to allow only one selection at a time within the layerList. Once I figure that out, I want to apply that code to my Climate Safe Neighborhoods Map. The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#multipleSelectionEnabled" rel="nofollow noreferrer" target="_blank"&gt;API documentation&lt;/A&gt; says to add the following code, but it doesn't say where.&lt;/P&gt;&lt;P&gt;layerList.selectionEnabled = true;&lt;/P&gt;&lt;P&gt;layerList.multipleSelectionEnabled = false;&lt;/P&gt;&lt;P&gt;I assumed these are attributes of the object so I added them here with no luck.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/GWORVTH/CSN.git" target="_self" rel="nofollow noreferrer"&gt;full html file&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I also tried adding the API documentation suggested code after the constant was created, and that didn't work. Thank you to anyone who can help me out with this. I am new to coding, and I have never done anything this complex.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2023 01:33:37 GMT</pubDate>
    <dc:creator>GroundworkORVGIS</dc:creator>
    <dc:date>2023-01-13T01:33:37Z</dc:date>
    <item>
      <title>Where should I place the layerList.multipleSelectionEnabled=false; property in ArcGIS Maps SDK for JavaScript 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1247924#M79891</link>
      <description>&lt;P&gt;I am trying to create a web application that allows users to explore layers related to climate safe neighborhoods. When I asked some of my colleagues to try an out of the box template from ArcGIS Online, they had difficulty understanding that they need to turn off layers above the layer they want to see to view it. I want to code a map that only allows users to select one layer at a time, so this doesn't happen, and I also want the legends to show with the layer list item. There's a solution on Stack Overflow that allows only one layer selection at a time that I found on this site, but it doesn't also show the legend, and it uses an older version of the API which I am not familiar with &lt;A href="https://stackoverflow.com/questions/43457902/single-layer-visible-in-layerlist-widget-arcgis-javascript" target="_blank"&gt;Single layer visible in LayerList widget (ArcGIS JavaScript)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Most of my data is Choropleth, so the layers cover each other even when I lower their opacity. I located an html file I created from my web mapping course in college, and I've been trying to modify it to allow only one selection at a time within the layerList. Once I figure that out, I want to apply that code to my Climate Safe Neighborhoods Map. The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#multipleSelectionEnabled" rel="nofollow noreferrer" target="_blank"&gt;API documentation&lt;/A&gt; says to add the following code, but it doesn't say where.&lt;/P&gt;&lt;P&gt;layerList.selectionEnabled = true;&lt;/P&gt;&lt;P&gt;layerList.multipleSelectionEnabled = false;&lt;/P&gt;&lt;P&gt;I assumed these are attributes of the object so I added them here with no luck.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/GWORVTH/CSN.git" target="_self" rel="nofollow noreferrer"&gt;full html file&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I also tried adding the API documentation suggested code after the constant was created, and that didn't work. Thank you to anyone who can help me out with this. I am new to coding, and I have never done anything this complex.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 01:33:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1247924#M79891</guid>
      <dc:creator>GroundworkORVGIS</dc:creator>
      <dc:date>2023-01-13T01:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Where should I place the layerList.multipleSelectionEnabled=false; property in ArcGIS Maps SDK for JavaScript 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1248031#M79893</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/543538"&gt;@GroundworkORVGIS&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks so much for adding the link to your html code it really helps.&amp;nbsp; I took a look and it looks like there were some issues with the AMD imports, it is important to keep the module references and callback parameters in the same order.&amp;nbsp; I created a &lt;A href="https://cdpn.io/pen/debug/NWBgvva?authentication_hash=ZoABaQGzvXEr" target="_self"&gt;codepen&lt;/A&gt; from your html file and after modifying the imports it seems to work as expected. You were adding the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#selectionEnabled" target="_self"&gt;selectionEnabled&lt;/A&gt; and &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#multipleSelectionEnabled" target="_self"&gt;multipleSelectionEnabled&lt;/A&gt; properties in the correct location.&amp;nbsp; They are both properties of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.htm" target="_self"&gt;LayerList&lt;/A&gt;, but I think there may be a little confusion on what these properties do.&lt;/P&gt;&lt;P data-unlink="true"&gt;These selection properties do not control the visibility of layers but allow the list items in the layer list to be selected.&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Selected items may be reordered in the LayerList&amp;nbsp; by dragging gestures with the mouse or touch screen, or with arrow keys on the keyboard and can be accessed with the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#selectedItems" target="_self"&gt;selectedItems&lt;/A&gt;&amp;nbsp;property for other custom workflows.&amp;nbsp; Unfortunately&amp;nbsp;there isn't an out of the box property on LayerList to allow for only one visible layer at a time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;You can however use a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GroupLayer.html" target="_self"&gt;GroupLayer&lt;/A&gt; with the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GroupLayer.html#visibilityMode" target="_self"&gt;visibilityMode&lt;/A&gt; set to "exclusive".&amp;nbsp; &amp;nbsp;Your LayerList would contain the one GroupLayer that would contain all your other layers and only allow for one of them to be visible at a time. This &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-layerlist-actions" target="_self"&gt;sample&lt;/A&gt; shows how to do that and the relevant code snippet is below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; const demographicGroupLayer = new GroupLayer({
  title: "US Demographics",
  visible: true,
  visibilityMode: "exclusive",
  layers: [USALayer, censusLayer],
  opacity: 0.75
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 13:59:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1248031#M79893</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-01-13T13:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Where should I place the layerList.multipleSelectionEnabled=false; property in ArcGIS Maps SDK for JavaScript 4.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1248086#M79895</link>
      <description>&lt;P&gt;Thank you so much for your response. I have tried this out with my climate safe layers and everything is working really well. I looked for code to add a legend that works with the GroupLayer &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-widget-with-grouplayers/m-p/372506#M34555" target="_self"&gt;here&lt;/A&gt;. It has been really helpful as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 16:00:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/where-should-i-place-the-layerlist/m-p/1248086#M79895</guid>
      <dc:creator>GroundworkORVGIS</dc:creator>
      <dc:date>2023-01-13T16:00:30Z</dc:date>
    </item>
  </channel>
</rss>

