<?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: WMSLayer event visible-layers-change in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55863#M4899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Noah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question was about the sublayers of a WMSLayer type.&lt;/P&gt;&lt;PRE style="background-color: #ffffff; border: 0px;"&gt;visibility-change&lt;/PRE&gt;&lt;P&gt;Is triggered when the layer itself has become visible/invisible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jan 2020 21:54:04 GMT</pubDate>
    <dc:creator>deleted-user-Rnbhf4vMniAn</dc:creator>
    <dc:date>2020-01-28T21:54:04Z</dc:date>
    <item>
      <title>WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55861#M4897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am incredibly new so I am walking in all the traps that exist at the moment for GIS development. I am wondering how I can capture the action of toggling the visibility in a sublayer of the WMSLayer type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;esri/map/Map&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;esri/dijit/LayerList&lt;/P&gt;&lt;P&gt;esri/layers/WMSLayer&lt;/P&gt;&lt;P&gt;and using&amp;nbsp;ArcGIS API for JavaScript&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a map, layerlist and added a WMSLayer. When the visibility of the layer changes I have used&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/wmslayer-amd.html#event-visibility-change" style="color: #00629b; text-decoration: none;"&gt;visibility-change&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;event to take action. However, when one of the sublayers is toggled. It's o so quiet, it's oh so still. I can not seem to find any event handling this action.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The map &lt;SPAN style="color: #636363; background-color: #fefefe;"&gt;ArcGISDynamicMapServiceLayer&amp;nbsp;&lt;/SPAN&gt;for example has this event :&amp;nbsp;&lt;/P&gt;&lt;TABLE style="color: #4d4d4d; background-color: #fafafa; border-width: 1px 1px 0px; border-style: solid; border-color: #d9d9d9; font-size: 14px; margin: 0.1em 0px 0.3em;"&gt;&lt;TBODY&gt;&lt;TR style="background-color: #fafafa; border-bottom: none;"&gt;&lt;TD class="" style="color: #595959; background-color: #fafafa; border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; font-size: 14px; padding: 4px 6px;"&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html#event-visible-layers-change" style="color: #00629b; text-decoration: none;"&gt;visible-layers-change&lt;/A&gt;&lt;/TD&gt;&lt;TD class="" style="color: #595959; background-color: #fafafa; border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; font-size: 14px; padding: 4px 6px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anybody who can push me in the right direction ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2019 14:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55861#M4897</guid>
      <dc:creator>deleted-user-Rnbhf4vMniAn</dc:creator>
      <dc:date>2019-11-25T14:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55862#M4898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like it should work, try this as a proof-of-concept:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;
&amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;
&amp;lt;title&amp;gt;Layer List WMS&amp;lt;/title&amp;gt;
&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/3.30/dijit/themes/claro/claro.css"&amp;gt;
&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/3.30/esri/css/esri.css"&amp;gt;

&amp;lt;style&amp;gt;
html, body, .container, #map {
 height:100%;
 width:100%;
 margin:0;
 padding:0;
 margin:0;
 font-family: "Open Sans";
}
#map {
 padding:0;
}
#layerListPane{
 width:25%;
}
.esriLayer{
 background-color: #fff;
}
.esriLayerList .esriList{
 border-top:none;
}
.esriLayerList .esriTitle {
 background-color: #fff;
 border-bottom:none;
}
.esriLayerList .esriList ul{
 background-color: #fff;
}
&amp;lt;/style&amp;gt;
&amp;lt;script&amp;gt;var dojoConfig = { parseOnLoad: true };&amp;lt;/script&amp;gt;
&amp;lt;script src="https://js.arcgis.com/3.30/"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
require([
 "esri/map",
 "esri/dijit/LayerList",
 "esri/layers/WMSLayer",
 "esri/layers/WMSLayerInfo",
 "esri/geometry/Extent",
 "dijit/layout/BorderContainer",
 "dijit/layout/ContentPane",
 "dojo/domReady!"
], function(
 Map,
 LayerList,
 WMSLayer,
 WMSLayerInfo,
 Extent
) {

 var map = new Map('map', {
 basemap: 'streets',
 center: [-96, 37],
 zoom: 4
 });

 var layer1 = new WMSLayerInfo({
 name: '1',
 title: 'Rivers'
 });

 var layer2 = new WMSLayerInfo({
 name: '2',
 title: 'Cities'
 });

 var resourceInfo = {
 extent: new Extent(-126.40869140625, 31.025390625, -109.66552734375, 41.5283203125, {
 wkid: 4326
 }),
 layerInfos: [layer1, layer2]
 };

 var wmsLayer = new WMSLayer('https://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer', {
 resourceInfo: resourceInfo,
 visibleLayers: ['1', '2']
 });

 var counter = 0;

 wmsLayer.on('visibility-change', function(layer) {
 console.log ('The layer changed. layer.id: ', layer.target.id);
 console.log ('counter: ', counter);
 counter++;
 });

 map.addLayers([wmsLayer]);
 
 var myWidget = new LayerList({
 map: map,
 layers: [wmsLayer]
 },"layerList");
 myWidget.startup();


});
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body class="claro"&amp;gt;
&amp;lt;div class="container" data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline',gutters:false"&amp;gt;
&amp;lt;div id="layerListPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'"&amp;gt;
 &amp;lt;div id="layerList"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 15:58:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55862#M4898</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-12-12T15:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55863#M4899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Noah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question was about the sublayers of a WMSLayer type.&lt;/P&gt;&lt;PRE style="background-color: #ffffff; border: 0px;"&gt;visibility-change&lt;/PRE&gt;&lt;P&gt;Is triggered when the layer itself has become visible/invisible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2020 21:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55863#M4899</guid>
      <dc:creator>deleted-user-Rnbhf4vMniAn</dc:creator>
      <dc:date>2020-01-28T21:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55864#M4900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a simple repro case on codepen or some other hosting site so I can see exactly what you're doing with the WMS sublayer visibility?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2020 22:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55864#M4900</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2020-01-28T22:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55865#M4901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I don't have code for it still, since there is no event to listen to. However I could produce code for another layer type, for which it does work. The layer type is the &amp;nbsp;ArcGisDynamicMapServiceLayer.&amp;nbsp; (See:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html" title="https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html"&gt;ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript 3.31&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the event I am using:&lt;/P&gt;&lt;TABLE style="color: #4d4d4d; background-color: #fafafa; border-width: 1px 1px 0px; border-style: solid; border-color: #d9d9d9; font-size: 14px; margin: 0.1em 0px 0.3em;"&gt;&lt;TBODY&gt;&lt;TR style="background-color: #fafafa; border-bottom: none;"&gt;&lt;TD class="" style="color: #595959; background-color: #fafafa; border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; font-size: 14px; padding: 4px 6px;"&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html#event-visible-layers-change" style="color: #00629b; text-decoration: none;"&gt;visible-layers-change&lt;/A&gt;&lt;/TD&gt;&lt;TD class="" style="color: #595959; background-color: #fafafa; border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; font-size: 14px; padding: 4px 6px;"&gt;&lt;PRE&gt;{   visibleLayers: &amp;lt;&lt;SPAN class=""&gt;&lt;CODE style="background: transparent;"&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" style="color: #00629b; text-decoration: none;"&gt;Number[]&lt;/A&gt;&lt;/CODE&gt;&lt;/SPAN&gt;&amp;gt; }&lt;/PRE&gt;&lt;/TD&gt;&lt;TD class="" style="color: #595959; background-color: #fafafa; border-width: 0px 0px 1px; border-style: solid; border-color: #d9d9d9; font-size: 14px; padding: 4px 6px;"&gt;Fires when the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background: transparent;"&gt;visibleLayers&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property is changed.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When In my code I listen to this event (visible-layers-change) in the arcGiSDynamicMapServiceLayer, It is thrown as soon as one of the SUB layers visibility&amp;nbsp;is changed. As soon as that happens I can collect the list of sublayers that are currently visible and persist these to the database. So the next time after reloading the page, I can re-enable the visibility for all layers, but also its sublayers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to do the same thing in the WMSLayer type, there is not such an event. Only the visibility-change event, that you have already mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I am just trying to find a way, to store state of the WMSLayer and its sublayers, so that I can recover the exact same state after the browser is reloaded, be loading the state info from a database.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2020 22:45:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55865#M4901</guid>
      <dc:creator>deleted-user-Rnbhf4vMniAn</dc:creator>
      <dc:date>2020-01-28T22:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55866#M4902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I thought you had an app that toggled the visibility of individual sublayers of a WMSLayer. One thing you could do would be to check the visibleLayers property of the&amp;nbsp;&lt;SPAN&gt;WMSLayer, that way you could ensure that the same state is always displayed whenever you want.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option would be to use the 4x version of the ArcGIS API for JavaScript (4.14 is the current version). The LayerList works well with the sublayers of a WMSLayer. Example app:&amp;nbsp;&lt;A class="link-titled" href="https://codepen.io/noash/pen/abzrRQb" title="https://codepen.io/noash/pen/abzrRQb"&gt;https://codepen.io/noash/pen/abzrRQb&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 22:33:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55866#M4902</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2020-01-29T22:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: WMSLayer event visible-layers-change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55867#M4903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Noah,&lt;/P&gt;&lt;P&gt;I just noticed your answer something must have gone wrong with the notification. So&amp;nbsp;although it’s already 3 months ago, thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will see&amp;nbsp;if an upgrade of the ArcGIS&amp;nbsp;AP.I. for JavaScript&amp;nbsp;shall&amp;nbsp;be helpfull.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2020 17:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/wmslayer-event-visible-layers-change/m-p/55867#M4903</guid>
      <dc:creator>deleted-user-Rnbhf4vMniAn</dc:creator>
      <dc:date>2020-05-04T17:19:28Z</dc:date>
    </item>
  </channel>
</rss>

