How to populated Attribute table from map layer (not url)

04-28-2020 07:00 AM
Occasional Contributor II

I have been trying to figure out how the Attribute table widget gets the data for populating the table. I have a simple app showing a layer pulled into the map using an ajax call to API, then displayed in the map using the following code:

var layerDefinition = {
					"geometryType": "esriGeometryPoint",
					"fields": fielddefs
                    //"maxScale": 72223.819286

				var QueryGraphics = [];
				for(var i = 0; i <; i++) {
					var attr =;
					//Build Graphic
					var graphicComp = new esri.geometry.Point(attr["lng"], attr["lat"], new esri.SpatialReference({ wkid: 4326 }))//4326 GCS_WGS_1984
					var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 10,
						new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
						new dojo.Color([255,255,255]), 1), new dojo.Color([255,0,0]));
					var template = new esri.InfoTemplate();
                    if(window.appInfo.isRunInMobile) {
                        template.setTitle("Gopher Tortoise Sighting");
                    } else {


					var pointGraphic = new esri.Graphic(graphicComp, symbol, attr, template)
                    //console.log("photographer: ",

        window.featureSet = QueryGraphics;
				var QueryfeatureSet = new esri.tasks.FeatureSet();
				QueryfeatureSet.features = QueryGraphics;
				QueryfeatureSet.geometryType = "esriGeometryPoint";
				QueryfeatureSet.spatialReference = new esri.SpatialReference({ wkid: 4326 });
        //console.log("query featureset ", QueryfeatureSet);
				var featureCollection = {
					layerDefinition: layerDefinition,
					featureSet: QueryfeatureSet

				var gtLayer =	new esri.layers.FeatureLayer(featureCollection, {
					id: "GopherTortoiseQuery",
					opacity: 0.6,
					infoTemplate: template,
					outFields: ["*"]
				}); = "GopherTortoiseQuery";
                //console.log("search result ", gtLayer);
				//Add Map Render
				renderer = new esri.renderer.SimpleRenderer(symbol);
        gtLayer.capabilities = "Map,Query,Data";
				//Add Layer to Map
        let map =;
        gtLayer.on("load", function() {
          let gtExt = graphicsUtils.graphicsExtent(gtLayer["_graphicsVal"]);
          //console.log("gt layer extent ", gtExt);
          gtLayer.initialExtent = gtExt;
          gtLayer.fullExtent = gtExt;
          map.setExtent(gtExt, true);
          //console.log("gopher tortoise layer ", gtLayer);

The problem is the Attribute table won't populate. It partially loads and doesn't throw any errors:

Also, the div isn't fully loading (the tab is missing) which suggests to me the code is hanging up some place, I just haven't been able to figure out where. When logging the config infos, the url is missing because I am not pulling in the layer from ArcGIS REST, so could that be the issue? If so how can I get the data to load from graphics layer and not from the url? I have been trying to find the correct function that I need to revise to do this, but have been unable to do so. 

I know the issue has to do with the layer or the url, because I set up a test app with point data referenced from ArcGIS REST and compared the two apps and cannot find any differences in any of the log statements, other than the missing url and the fact that the data is missing from the domNode (innerText)

I can provide additional info if needed and thanks ahead for any suggestions. Basically If I know which function I need to be in, I can figure it out! 

0 Kudos
1 Reply
MVP Esteemed Contributor


   Not sure why you are not using AMD style coding (especially in this day and age!). But here is how I add feature layers to my map from a widget in WAB that does not use a URL. I have no problem with them showing in the AT Widget.

          var layerInfo = {
            "type" : "Feature Layer",
            "description" : "",
            "definitionExpression" : "",
            "name": "Search Buffer Results",
            "geometryType": "esriGeometryPolygon",
            "objectIdField": "ObjectID",
            "drawingInfo": {
              "renderer": {
                "type": "simple",
                "label": "Buffer",
                "description" : "Buffer",
                "symbol": this.config.bufferDefaults.simplefillsymbol
            "fields": [{
              "name": "ObjectID",
              "alias": "ObjectID",
              "type": "esriFieldTypeOID"
            }, {
              "name": "bufferdist",
              "alias": "Buffer Distance",
              "type": "esriFieldTypeString"

          var featureCollection = {
            layerDefinition: layerInfo,
            featureSet: null
          this.graphicsLayerBuffer = new FeatureLayer(featureCollection);
 = "Search Buffer Results";

          ///Add some graphic to the layer, Normally in some sort of results loop

          ///Zoom to the extent of the layer
          var gExt = graphicsUtils.graphicsExtent(;
          if (gExt) {
  , true);
0 Kudos