Problem with LayerList visibility toggle

12-04-2018 10:02 AM
Occasional Contributor

I am trying to pull in a MapImageLayer and show a LayerList that will allow users to toggle the visibility of the sub layers.  I was hoping to do it this simply:

      Map, MapView, MapImageLayer, Print, LayerList

      myApp.myLayer = new MapImageLayer({
         url: "https://server/arcgis/rest/services/Viewer/Layers/MapServer",
         title: "Layers",
         visible: true
      }); = new Map({basemap: "streets", layers:[myApp.myLayer]});
      myApp.view = new MapView({
        container: "viewDiv",
         zoom: 8,
        center: [-81.034814, 33.6],

         var layerList = new LayerList({
      myApp.view.ui.add(layerList, "bottom-right")


However, I have a bunch of sublayers within sublayers in this map service.  It's arranged like this:

  • Transmission
    • Energized Layers
      • Energized Substation
      • Energized Structure
    • Inactive Layers
      • Inactive Substation
      • Inactive Structure
  • Distribution
    • Primary
    • Secondary
  • Environmental

etc, etc.  I find I can toggle the visibility on the map service as a whole, or on the primary subgroup (Transmission, Distirbution, etc) But everything below that doesn't allow me to toggle....

Is there a setting somewhere that will let me do this? Or am I going to have to pull each and every one of these subgroups in individually??  

0 Kudos
0 Replies