Select to view content in your preferred language

InfoTemplate format for ArcGISDynamicMapServiceLayer Sub Layers

1261
3
Jump to solution
05-18-2018 10:22 AM
MarkBuie1
Occasional Contributor

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,
    })
);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

I have seen services have quirks like this before. The best thing to do is delete and republish.

View solution in original post

0 Kudos
3 Replies
MarkBuie1
Occasional Contributor

So, this appears to be isolated to the map service I'm using. I have tried my code using several other services and have not been able to reproduce the error. 

I will try to post if I ever figure out what is happening with this particular service. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I have seen services have quirks like this before. The best thing to do is delete and republish.

0 Kudos
MarkBuie1
Occasional Contributor

Thanks, Robert. Ended up needing to recreate the .mxd then republish to get it working again. 

0 Kudos