Editor Widget shows 'undefined' after selecting features for editing

821
3
Jump to solution
04-23-2020 12:28 PM
JoeBriggs1
New Contributor II

I'm using esri-loader which loads ArcGIS 4.15 in an angular cli v9 app.  I'm experiencing the following behavior with the editor widget:

Essentially the attributes aren't showing up when initially selecting the area.  Only 'undefined' for all features & layers.  When I drill down to the feature, the attributes appear fine.  I noticed a similar behavior with popups, where the popup was displaying attributes as 'undefined', but was able to resolve it there by setting the "outfields" property on the popup.  However, there doesn't appear to be a similar property for the editor widget.  Thoughts?

0 Kudos
1 Solution

Accepted Solutions
JoeBriggs1
New Contributor II

So, after looking through the api a little more, I found the "displayField" property.  That did the trick.

      var trailheadsLayer = new FeatureLayer({
       url: "https://services6.arcgis.com/708LZoWlLL5mAZXZ/arcgis/rest/services/trailheads/FeatureServer",
       popupTemplate: trailHeadPop,
       displayField: "TRL_NAME",
       outFields: ["*"]
      });

Thanks for your help and apologies for not reading the api a little more thoroughly before posting!

View solution in original post

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

Did you set the outFields property of the FeatureLayer?

0 Kudos
JoeBriggs1
New Contributor II

Thanks for the quick reply. 

I had not set it for the layer, only popups.  I just adjusted the code (see below) but unfortunately it didn't seem to help. 

      var trailheadsLayer = new FeatureLayer({
       url: "https://services6.arcgis.com/708LZoWlLL5mAZXZ/arcgis/rest/services/trailheads/FeatureServer",
       popupTemplate: trailHeadPop,
       outFields: ["*"]
      });

0 Kudos
JoeBriggs1
New Contributor II

So, after looking through the api a little more, I found the "displayField" property.  That did the trick.

      var trailheadsLayer = new FeatureLayer({
       url: "https://services6.arcgis.com/708LZoWlLL5mAZXZ/arcgis/rest/services/trailheads/FeatureServer",
       popupTemplate: trailHeadPop,
       displayField: "TRL_NAME",
       outFields: ["*"]
      });

Thanks for your help and apologies for not reading the api a little more thoroughly before posting!

0 Kudos