Adding a FeatureLayer with a configured popup

845
2
Jump to solution
09-06-2017 12:13 PM
KenBuja
MVP Esteemed Contributor

In my widget, I'm adding a FeatureLayer that is a hosted feature service on AGOL. It has a popup configured and some of the fields contain domains. I can add the layer to the existing web map, but I can't seem to get the configured popup to show up properly. This is how it's configured in the service.

If I use the syntax

this._layerSPGrid = new FeatureLayer(SPGridUrl, {
  outFields: ['*'],
  id: "Priority", 
  infoTemplate: new InfoTemplate()
});
this.map.addLayer(this._layerSPGrid);

then the popup doesn't show the field aliases or domain values and gives me some extraneous fields (GlobalID, Shape__Area, Shape__Length)

If I omit the infoTemplate from the constructor, I have to go into the Layer List widget and enable the popup. This popup shows the domains, but not the field aliases and adds Shape__Area and Shape__Length

What's the correct way to add the configured popup? I don't want to configure the infoTemplate in the code. I could live with the second option, but I don't want to require the user to enable the popup.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Ken,

   See this thread on how to automatically enable the popup for a layer:

https://community.esri.com/thread/159817#comment-524066 

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Ken,

   See this thread on how to automatically enable the popup for a layer:

https://community.esri.com/thread/159817#comment-524066 

0 Kudos
KenBuja
MVP Esteemed Contributor

Thanks Robert. Too bad that doesn't use the configured popup from the hosted feature service, but it's better than no domains.

0 Kudos