AnsweredAssumed Answered

iterate through sub-layers

Question asked by befoley1960 on Sep 13, 2016
Latest reply on Sep 13, 2016 by cgishack

I have a dynamicmapservicelayer (dynaLayer1) that has three layers. Each layer then has at least 2 sub-layers beneath it. 

 

dynaLayer1

----> Layer 1

--------> Sub-Layer 1

--------> Sub-Layer 2

----> Layer 2

--------> Sub-Layer 1

--------> Sub-Layer 2

----> Layer 3

--------> Sub-Layer 1

--------> Sub-Layer 2

 

I am using the following code to get the layers.  How can I get to the sub-layers (Sub-Layer 1 & 2) below that ?

Thanks.

 

dojo.connect(dynaLayer1, "onLoad", function () {
    var infos = dynaLayer1.layerInfos;
        for (var i = 0; i <= infos.length - 1; i++) {  
                var layerId = infos[i].id;
                var layerName = infos[i].name;
                var layerVisible = infos[i].defaultVisibility;
                       

                alert("layerId : " + layerId + ".....layerName : " + layerName + ".....visible : " + layerVisible);
         }    })

Outcomes