<?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: Only one layer visible at any time AGSJS TOC in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583055#M54459</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Dear all,&lt;BR /&gt;&lt;BR /&gt;I would like to change the behaviour of the agsjs TOC control so that only one layer is visible at any given time. If user clicks a layer to make it visible then the control should automatically uncheck the previous visible layer if any is visible.&lt;BR /&gt;&lt;BR /&gt;Can someone advise on how best to achieve this?&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could modify the widget to emit an event when a layer is set to visible (and pass along the ID or reference to that layer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you could set up a listener for that specific event, and hide all other layers based on that.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Mar 2014 21:38:47 GMT</pubDate>
    <dc:creator>JonathanUihlein</dc:creator>
    <dc:date>2014-03-26T21:38:47Z</dc:date>
    <item>
      <title>Nested group layer visibility in AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583049#M54453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to get all the checkboxes nested below a group layer to update when the top group layer checkbox is toggled. Currently when the top group layer is toggled all child nodes directly below that group are also toggled, but the lower nested group layers remain unchanged. A bit confusing to explain so I've attached a screenshot to illustrate. I would like to update the visibility of A1, A2, etc. by toggling "Group Layer". Great tool by the way, thanks nliu.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]20744[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2013 18:08:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583049#M54453</guid>
      <dc:creator>DerekWicks1</dc:creator>
      <dc:date>2013-01-15T18:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Nested group layer visibility in AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583050#M54454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I've narrowed it down to the _createChildrenNodes, which needs to be modified so that children of children are appended to the parent layer node array and are updated when _adjustToState is called. However, I'm having some trouble following this bit of code, could you provide any suggestions nliu?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _createChildrenNodes: function (a, b) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.rootLayerTOC._currentIndent++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var d = [], c = 0, e = a.length; c &amp;lt; e; c++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var g = a&lt;C&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootLayerTOC: this.rootLayerTOC,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootLayer: this.rootLayer,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer: this.layer,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; legend: this.legend
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f&lt;B&gt; = g;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.data = g;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g = new agsjs.dijit._TOCNode(f);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.placeAt(this.containerNode);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.push(g)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this._childTOCNodes = d;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.rootLayerTOC._currentIndent--
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/B&gt;&lt;/C&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:04:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583050#M54454</guid>
      <dc:creator>DerekWicks1</dc:creator>
      <dc:date>2021-12-12T01:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Nested group layer visibility in AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583051#M54455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should change _onClick event handler, not _createChildrenNodes because what you want to change is behavior of the click, not how the TOC is presented. You probably need to create an inner function and make recursive calls to set visibility of all offsprings layers that is not direct children of the clicked group layer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, you do not have to format the compressed code to make changes, the original source code is in the "src" folder.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 17:45:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583051#M54455</guid>
      <dc:creator>NianweiLiu</dc:creator>
      <dc:date>2013-01-16T17:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Nested group layer visibility in AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583052#M54456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, great job on the widget!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 18:08:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583052#M54456</guid>
      <dc:creator>DerekWicks1</dc:creator>
      <dc:date>2013-01-16T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nested group layer visibility in AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583053#M54457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;nliu this is fantastic! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have your or anyone integrated this into ESRI's Basic Viewer sample viewer template? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm just beginning with javascript and I would be very appreciative if anyone that has integrated these could share their code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2013 17:42:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583053#M54457</guid>
      <dc:creator>KevinMacLeod1</dc:creator>
      <dc:date>2013-01-17T17:42:39Z</dc:date>
    </item>
    <item>
      <title>Only one layer visible at any time AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583054#M54458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to change the behaviour of the agsjs TOC control so that only one layer is visible at any given time. If user clicks a layer to make it visible then the control should automatically uncheck the previous visible layer if any is visible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone advise on how best to achieve this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 13:22:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583054#M54458</guid>
      <dc:creator>wadsonmakari</dc:creator>
      <dc:date>2014-03-26T13:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Only one layer visible at any time AGSJS TOC</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583055#M54459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Dear all,&lt;BR /&gt;&lt;BR /&gt;I would like to change the behaviour of the agsjs TOC control so that only one layer is visible at any given time. If user clicks a layer to make it visible then the control should automatically uncheck the previous visible layer if any is visible.&lt;BR /&gt;&lt;BR /&gt;Can someone advise on how best to achieve this?&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could modify the widget to emit an event when a layer is set to visible (and pass along the ID or reference to that layer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you could set up a listener for that specific event, and hide all other layers based on that.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 21:38:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nested-group-layer-visibility-in-agsjs-toc/m-p/583055#M54459</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-03-26T21:38:47Z</dc:date>
    </item>
  </channel>
</rss>

