AnsweredAssumed Answered

InfoTemplate format for ArcGISDynamicMapServiceLayer Sub Layers

Question asked by mebuie on May 18, 2018
Latest reply on May 21, 2018 by mebuie

I am having trouble getting each individual layer within an ArcGISDynamicMapServiceLayer to display an InfoTemplate on popup using ArcGIS API for JavaScript 3.24. There are seven layers within the ArcGISDynamicMapServiceLayer, two of which have parent layers. All the layers not within a parent layer display correctly. However, none of the sub layers will display their InfoTemplate. 

 

My question is, what is the proper format of the infoTemplates object when an ArcGISDynamicMapServiceLayer contains sub layers?

 

Here is a screen shot of the layerInfos from the service:

layerInfos

 

...and here is the format I'm following:

var infoTemplates = {
    //works
    0: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    },
    //does not work
    2: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    },
    //does not work
    3: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    },
    //works
    4: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    },
    //works
    5: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    },
    //works
    6: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    },
    //works
    7: {
        infoTemplate: new InfoTemplate("test", "${*}"),
        layerUrl: null
    }
};

map.addLayer(
    new ArcGISDynamicMapServiceLayer(someURL, {
        id: someID,
        infoTemplates: infoTemplates,
    })
);

Outcomes