<?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 Enable and Disable LayerList actions in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/enable-and-disable-layerlist-actions/m-p/1556692#M86044</link>
    <description>&lt;P&gt;i am trying to figure out how to dynamically enable and disable layerlist actions.&lt;BR /&gt;&lt;BR /&gt;say the actions list example from website&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;enableControls = false;
&amp;lt;button (click)="enableControls = !enableControls"&amp;gt;Toggle Control&amp;lt;/button&amp;gt;

const layerList = new LayerList({
  view: view,
  // executes for each ListItem in the LayerList
  listItemCreatedFunction: defineActions
});

async function defineActions(event) {
  if(!enableControls)
    return;

  const item = event.item;

  await item.layer.when();

  if (item.title === "US Demographics") {
    item.actionsSections = [
      [
        {
          title: "Go to full extent",
          icon: "zoom-out-fixed",
          id: "full-extent"
        },
        {
          title: "Layer information",
          icon: "information",
          id: "information"
        }
      ],
      [
        {
          title: "Increase opacity",
          icon: "chevron-up",
          id: "increase-opacity"
        },
        {
          title: "Decrease opacity",
          icon: "chevron-down",
          id: "decrease-opacity"
        }
      ]
    ];
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case when user clicks toggle controls, i want to enable/disable the controls in layer list.&lt;/P&gt;&lt;P&gt;However this approach doesn't seem to work as it seems to render the controls once off and moves on.&lt;/P&gt;&lt;P&gt;Is there a way to dynamically toggle controls when enableControl value changes effectively?&lt;/P&gt;</description>
    <pubDate>Fri, 08 Nov 2024 03:06:45 GMT</pubDate>
    <dc:creator>Aeseir</dc:creator>
    <dc:date>2024-11-08T03:06:45Z</dc:date>
    <item>
      <title>Enable and Disable LayerList actions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/enable-and-disable-layerlist-actions/m-p/1556692#M86044</link>
      <description>&lt;P&gt;i am trying to figure out how to dynamically enable and disable layerlist actions.&lt;BR /&gt;&lt;BR /&gt;say the actions list example from website&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;enableControls = false;
&amp;lt;button (click)="enableControls = !enableControls"&amp;gt;Toggle Control&amp;lt;/button&amp;gt;

const layerList = new LayerList({
  view: view,
  // executes for each ListItem in the LayerList
  listItemCreatedFunction: defineActions
});

async function defineActions(event) {
  if(!enableControls)
    return;

  const item = event.item;

  await item.layer.when();

  if (item.title === "US Demographics") {
    item.actionsSections = [
      [
        {
          title: "Go to full extent",
          icon: "zoom-out-fixed",
          id: "full-extent"
        },
        {
          title: "Layer information",
          icon: "information",
          id: "information"
        }
      ],
      [
        {
          title: "Increase opacity",
          icon: "chevron-up",
          id: "increase-opacity"
        },
        {
          title: "Decrease opacity",
          icon: "chevron-down",
          id: "decrease-opacity"
        }
      ]
    ];
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case when user clicks toggle controls, i want to enable/disable the controls in layer list.&lt;/P&gt;&lt;P&gt;However this approach doesn't seem to work as it seems to render the controls once off and moves on.&lt;/P&gt;&lt;P&gt;Is there a way to dynamically toggle controls when enableControl value changes effectively?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 03:06:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/enable-and-disable-layerlist-actions/m-p/1556692#M86044</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2024-11-08T03:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Enable and Disable LayerList actions</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/enable-and-disable-layerlist-actions/m-p/1556738#M86045</link>
      <description>&lt;P&gt;Solved it, by using a empty function&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 08:51:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/enable-and-disable-layerlist-actions/m-p/1556738#M86045</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2024-11-08T08:51:45Z</dc:date>
    </item>
  </channel>
</rss>

