<?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: Disable show/hide button from LayerList ArcGIS Javascript in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/disable-show-hide-button-from-layerlist-arcgis/m-p/1262428#M80410</link>
    <description>&lt;P data-unlink="true"&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/657951"&gt;@aggarwalarpit93&lt;/a&gt;, There really isn't a supported way to disable the ability to show and hide the layer in the layer list.&amp;nbsp; The primary propose of the layer list is to allow users to control the visibility of layers.&amp;nbsp; You could remove the layer you want to be visible all the time from the layer list by setting the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#listMode" target="_self"&gt;listMode&lt;/A&gt;&amp;nbsp;on your feature layer to `&lt;SPAN&gt;hide` and the visible property to `true`.&amp;nbsp; This would remove that layer from the layer list and make it visible.&amp;nbsp; Another option would be to use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html" target="_blank"&gt;legend&lt;/A&gt; widget instead of the layer list. The legend doesn't allow users to control visibility and provides a descriptions of the symbols used to represent the layers in the map.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2023 13:24:08 GMT</pubDate>
    <dc:creator>Sage_Wall</dc:creator>
    <dc:date>2023-02-28T13:24:08Z</dc:date>
    <item>
      <title>Disable show/hide button from LayerList ArcGIS Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/disable-show-hide-button-from-layerlist-arcgis/m-p/1262328#M80404</link>
      <description>&lt;P&gt;Hello, I have a map and I have added a feature layer. It is displayed on the LayerList as well.&lt;/P&gt;&lt;P&gt;What I want is, currently user can show or hide this layer from the LayerList but I want it to be permanent on the Map. So I want to disable or hide this eye button which show/hide the layer on the map.&lt;/P&gt;&lt;P&gt;Here is my sample code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;script&amp;gt;
        require([
            "esri/config",
            "esri/Map",
            "esri/views/MapView",
            "esri/layers/FeatureLayer",
            "esri/Basemap",
            "esri/Graphic",
            "esri/layers/GraphicsLayer",
            "esri/symbols/PictureMarkerSymbol",
            "esri/layers/support/LabelClass",
            "esri/rest/support/Query",
            "esri/geometry/Point",
            "esri/views/layers/LayerView",
            "esri/rest/locator",
            "esri/geometry/Polygon",
            "esri/symbols/SimpleLineSymbol",
            "esri/symbols/SimpleFillSymbol",
            "esri/widgets/LayerList",
            "esri/widgets/Expand",
        ], (esriConfig, Map, MapView, FeatureLayer, Basemap, Graphic, GraphicsLayer, PictureMarkerSymbol, LabelClass, Query, Point, LayerView, locator, Polygon, SimpleLineSymbol, SimpleFillSymbol, LayerList, Expand) =&amp;gt; {

            esriConfig.apiKey= API_KEY;

            const map = new Map();

            // const map = new Map({
            //     basemap: "arcgis-topographic" // Basemap layer
            // });

            const view = new MapView({
                map: map,
                center: [85.7780685, 25.8560264],
                scale: 1800000,
                container: "viewDiv",
                constraints: {
                    snapToZoom: false
                }
            });

            // District feature layer
            // Add district layer custom layout
            const districtLayerBorderLayout = {
                type: "simple",
                symbol: {
                    type: "simple-line",
                    style: "short-dot",
                    color: "#000000",
                    width: "1px"
                }
            };

            const districtLayerTextLayout = new LabelClass({
                symbol: {
                    type: "text",
                    color: "#ff00ff",
                    font: {
                        size: 10
                    }
                },
                labelExpressionInfo: {
                    expression: "$feature.D_NAME"
                }
            });

            // Add district layer to the mapview
            const districtLayer = new FeatureLayer({
                url: "https://gis.fmiscwrdbihar.gov.in/arcgis/rest/services/GisAtlas/GIS_Atlas_2023/MapServer/22",
                outFields:["*"],
                renderer: districtLayerBorderLayout,
                labelingInfo: [districtLayerTextLayout]
            });
            map.add(districtLayer, 0);

            // layer list widget
            ////////////////////////// Add legend //////////////////////////
            const layerList = new LayerList({
                view: view
            });

            const layerListExpand = new Expand({
                expandIconClass: "esri-icon-layers",
                expandTooltip: "LayerList",
                view: view,
                expanded: false,
                content: layerList,
                group: "expandable-widgets"
            });

            view.ui.add([layerListExpand], "top-right")

        });
    &amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Feb 2023 06:59:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/disable-show-hide-button-from-layerlist-arcgis/m-p/1262328#M80404</guid>
      <dc:creator>aggarwalarpit93</dc:creator>
      <dc:date>2023-02-28T06:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Disable show/hide button from LayerList ArcGIS Javascript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/disable-show-hide-button-from-layerlist-arcgis/m-p/1262428#M80410</link>
      <description>&lt;P data-unlink="true"&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/657951"&gt;@aggarwalarpit93&lt;/a&gt;, There really isn't a supported way to disable the ability to show and hide the layer in the layer list.&amp;nbsp; The primary propose of the layer list is to allow users to control the visibility of layers.&amp;nbsp; You could remove the layer you want to be visible all the time from the layer list by setting the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#listMode" target="_self"&gt;listMode&lt;/A&gt;&amp;nbsp;on your feature layer to `&lt;SPAN&gt;hide` and the visible property to `true`.&amp;nbsp; This would remove that layer from the layer list and make it visible.&amp;nbsp; Another option would be to use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html" target="_blank"&gt;legend&lt;/A&gt; widget instead of the layer list. The legend doesn't allow users to control visibility and provides a descriptions of the symbols used to represent the layers in the map.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 13:24:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/disable-show-hide-button-from-layerlist-arcgis/m-p/1262428#M80410</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-02-28T13:24:08Z</dc:date>
    </item>
  </channel>
</rss>

