madgame

TypeError: io is undefined

Discussion created by madgame on May 26, 2011
I've been getting TypeError: io is undefined exceptions when trying to add a feature onto a feature layer.  Could you tell me what causes this exception?  Using wireshark, I don't see it trying to add the items to the feature layer.  Using FireBug, I can see that it is accessing the FeatureService correctly and populating the template/attributes properly.


var scratchPadLayerRef = new esri.layers.FeatureLayer("http://XYZ.com/ArcGIS/rest/services/Correlation/FeatureServer/2", {
  mode: esri.layers.FeatureLayer.MODE_ONDEMAND, 
  infoTemplate:longTermCorrTemplate,
  outFields:["*"]});

...

        try {
            var layerRef = scratchPadLayerRef;
            layerRef.refresh();
            var templates = layerRef.templates;
            var types = layerRef.types;

            var pt = longTermGraphics[0].geometry;
            var sms = templates[0].prototype.symbol;
            var attr = templates[0].prototype.attributes;
            var info = longTermGraphics[0].infoTemplate;
            var graphic = templates[0].prototype;
            graphic.setGeometry(pt);
            graphic.attributes.oid = longTermGraphics[0].attributes.oid;
            graphic.attributes.lat = longTermGraphics[0].attributes.lat;
            graphic.attributes.lon = longTermGraphics[0].attributes.lon;
            graphic.attributes.ident = 'CC100';
            layerRef.applyEdits([graphic], null, null, function(addResults) {
                alert('success');
            },function(err){
              alert(err);
            });
        } catch (err) {
            alert('Could not post changes to the server: ' + err);
        }

Outcomes