AnsweredAssumed Answered

MapImageLayer only able to display one sublayer at a time

Question asked by ibroad on Aug 24, 2017
Latest reply on Aug 24, 2017 by ibroad

I'm setting the sublayer property on a MapImageLayer, and setting a popupTemplate for each layer, but when I set more than one sublayer nothing displays on the map.

 

If I only put one sublayer, then it displays fine. But if I add a second sublayer, then nothing is displayed at all.

 

I'm getting no errors in the console. Here's the code, it's pretty straightforward:

 

viewer = new MapImageLayer({
     url: "http://server:6080/arcgis/rest/services/folder/service/MapServer",

     sublayers: [
          {
               id: 4,
               visible: true,

               popupTemplate: {
                    title: "Field: {field}",

                    content: "<ul><li>Field2: {Field2}</li>" +
                         "<li>Field3: {Field3}</li>" +
                         "<li>Field4: {Field4}</li>" +
                         "<li>Field5: {Field5}</li><ul>"
               }
          },
          {
               id: 30,
               visible: true,

               popupTemplate: {
                    title: "Field: {field}",

                    content: "<ul><li>Field2: {Field2}</li>" +
                         "<li>Field3: {Field3}</li>" +
                         "<li>Field4: {Field4}</li>" +
                         "<li>Field5: {Field5}</li><ul>"
               }
          }
     ]
});

map.addMany([viewer, layer, layer2]);

 

Any idea what could be wrong?

Outcomes