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:
...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,
})
);
Solved! Go to Solution.
I have seen services have quirks like this before. The best thing to do is delete and republish.
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.
I have seen services have quirks like this before. The best thing to do is delete and republish.
Thanks, Robert. Ended up needing to recreate the .mxd then republish to get it working again.