AnsweredAssumed Answered

Getting layer data to display in Attribute Table

Question asked by jhovanec_TowsonU on Mar 19, 2019
Latest reply on Mar 26, 2019 by jhovanec_TowsonU

I'm building a custom widget and am trying to add a layer to the Attributes Table. I believe my layer is successfully being added to the Attributes Table as I can see the column headers change for the layer when added. My issue is that I'm not seeing any data from my layer show-up in the Attributes Table. 


Where does the Attribute Table pull the data from for a layer?


Below is a sample of how I am creating the FeatureLayer that will be added to the table:

 const polyline = new Polyline(polylineJson);
var routeInfoTemplate = new InfoTemplate('Route Name:' + route.attributes.Name);
var routeAttributes = {
   RouteName: route.attributes.Name,
   OrderCount: route.attributes.OrderCount,

const polylineGraphic = new context.esriJS.Graphic({
   'geometry': polyline,
   'symbol': { "color": colorArr[i], "width": 1, "type": "esriSLS", "style": "esriSLSSolid" },
   'attributes': routeAttributes,
   'infoTemplate': routeInfoTemplate

var layerDefinition = {
  "name": "SHA Test " + route.attributes.Name,
  "geometryType": "esriGeometryPolyline",
  "fields": [{
  "name": "Name",
  "alias": "RouteName",
  "type": "esriFieldTypeString"
}, {
  "name": "OrderCount",
  "alias": "Order Count",
  "type": "esriFieldTypeString"

// Define the featureCollection
var featureCollection = {
   layerDefinition: layerDefinition,
   featureSet: routes.attributes   // routes are returned from the Rest Api

 // Define the featureLayer
var featureLayer = new FeatureLayer(featureCollection, {
id: 'Routing Solution ' + route.attributes.Name,
showLabels: true




I'm very new to Esri APIs, so if I'm missing something obvious please feel free to point it out. I feel like this is probably very simple, but I appreciate any help in advance.