AnsweredAssumed Answered

Popups using MapImageLayer and LayerList Widget

Question asked by sarojthapa60 on Aug 11, 2017
Latest reply on Aug 11, 2017 by rscheitlin

I have a mapservice that has 3 layers and each layer has sublayers. I am using mapImageLayer to call popups with the properties sublayers and popupTemplate as displayed below:

var displayLayer = new MapImageLayer({
  url: "RESTURL/endpoints",
  sublayers: [{
    id: 10,
    title: "Gas Main",
    popupTemplate: {
      title: "Gas Main",
      content: [{
        type: "fields",
        fieldInfos: [
          {fieldName: "INSTALLDATE", visible: true, label: "Install Date", format: {dateFormat: "short-date"}},
          {fieldName: "SUBTYPECD", visible: true, label: "Type"}
        ]
      }]
    }
  }]
});

The layers structure is:

Layer1 has index 0. Layer1 has two subLayers - sublayer1 with index 1 and sublayer2 with index 2.

Layer 2 has index 3.  

I am using layerlist widget. When I have sublayers in the MapImageLayer, the layerlist displays all the layers at once without honoring the sublayers. 

But when I do not have "sublayers" property in my MapImageLayer, the layerlist displays layers fine honoring the sublayers. I do not want to use feature layers just to make popups.

Any ideas on how to reconcile popup and layerlist widget.

Thanks 

Outcomes