AnsweredAssumed Answered

Accessing layer properties of a LayerList JavaScript version 3.23

Question asked by carlos.montano on May 11, 2018
Latest reply on May 14, 2018 by rscheitlin

I programmed an application in ArcGIS JavaScript version 3.23. The aplication uses a LayerList. It is required to know if one of the layers is visible (active) or not in order to be able to perform another action. Which is te ay to access de visibility property of any of the layers? or How sholuld I know if one of the layers was activated by te user and it is visible?. The idea is that when any of the layers Aquifers or Basins is selected and that the user clicks on some element, Aquifer or Basin, select this element in a unique way.

Next I show the parts of the program that I use = new Map("map", {
            map: map,
         basemap: "topo",      
         center: [-102.199176, 23.068129],
         minZoom: 4,
         autoResize: true,
         zoom: 5,
         fadeOnZoom: true,
         infoWindow: popup,
         navigationMode: "css-transforms"

 "layers-add-result", function (evt) {
  var layerListDom = new LayerList({
     layers:  [{
     layer: f1,
        showSubLayers: false,
        showLegend: true,
        showOpacitySlider: true,
        visibility: false,
        id: "Aquifers"
        layer: f2,
     showSubLayers: false,
     showLegend: true,
     showOpacitySlider: true,
     visibility: false,
     id: "Basins"
     layerListDom.startup();"click", function (evt) {
     var query = new Query();
     query.geometry = evt.mapPoint;
     var layer_visible =[0]);
     var layer_visible1 =[1]);
   if (layer_visible.visibility === true) {
  var deferred = f1.selectFeatures(query, FeatureLayer.SELECTION_NEW, function
  (selection) {     });
  if (layer_visible1.visibility === true) {
   var deferred = f2.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (selection) { });