AnsweredAssumed Answered

esri.layers and AMD - urgent

Question asked by gsimpson4 on Oct 10, 2012
Latest reply on Oct 11, 2012 by DSwingley-esristaff
I know that version 3.2 of the JS API is not totally AMD compliant yet, but the application I am writing is. So far I haven't had many issues except for the use of esri.layers within an AMD module. More specifically, I get

TypeError: Unable to draw graphic (geometry:null, symbol:null): _14 is undefined
http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/layers/FeatureLayer.js
Line 19


when trying to create FeatureLayers. What can I do within my module to get the layer constructors to work? I've noticed that these errors go away with 3.3 of the API, but since that version is not yet final there are other features that are broken for now (using stores with FilteringSelect).

define(["dojo/_base/declare", "esri/layers/FeatureLayer", "esri/layers/agstiled", "esri/layers/dynamic" ], function (declare, FeatureLayer, TiledLayer, DynamicLayer) {      return declare([], {         id: null,         agsid: null,         URL: null,         layertype: null,         maplayer: null,         constructor: function (lyr) {             this.id = lyr.Layer_ID;             this.ags_id = lyr.AGS_ID;             this.layertype = lyr.LayerType;              switch (this.layertype) {                 case "featurelayer":                     this.URL = lyr.Service_URL + "/FeatureServer/" + this.agsid;                     this.maplayer = new esri.layers.FeatureLayer(this.URL, {                         mode: esri.layers.FeatureLayer.MODE_ONDEMAND,                         outFields: ["*"]                     });                     break;                 case "tiled":                     this.URL = lyr.Service_URL + "/MapServer" + ((this.agsid) ? ("/" + this.agsid) : (""));                     this.maplayer = new TiledLayer(this.URL);                     break;                 case "dynamic":                     this.URL = lyr.Service_URL + "/MapServer" + ((this.agsid) ? ("/" + this.agsid) : (""));                     this.maplayer = new DynamicLayer(this.URL);                     //this.maplayer = new esri.layers.ArcGISDynamicMapServiceLayer(this.URL);                     break;                 default:                     this.URL = lyr.Service_URL + "/MapServer" + ((this.agsid) ? ("/" + this.agsid) : (""));                     this.maplayer = new DynamicLayer(this.URL);                     //this.maplayer = new esri.layers.ArcGISDynamicMapServiceLayer(this.URL);                     break;             }         }     }); });

Outcomes