Select to view content in your preferred language

TypeError: io is undefined

546
0
05-26-2011 09:49 AM
MichaelMurphy8
Deactivated User
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);
        }
0 Kudos
0 Replies