AnsweredAssumed Answered

Debug FeatureLayer.applyEdits() - not saving

Question asked by sarahclark on Nov 10, 2015
Latest reply on Nov 12, 2015 by thebillcarr

Hello -

 

I've had a web app that edits a polygon feature layer for over a year now and I just noticed that updating attributes is not working. I followed this sample very closely: Using the attribute inspector | ArcGIS API for JavaScript . I use layer.applyEdits(null, [feature], null) and confirmed in the console that the feature I pass in to be updated has the edits that I want to apply.

 

If I listen for the 'edits-complete' event I get the results and that the update was a success. I'm not getting any errors. There is an "OBJECTID" field that is a number. But the edits are not saving to the layer-- if I save the edits, close the attribute inspector and then re-open the attribute inspector, the edits are gone.

 

Does anyone have any debugging ideas? Without error messages I've hit a wall on what to check.

 

Thanks!

 

saveClickFunction : function(feature, attIn) {
            var saveClickDeferred = new Deferred;
       
            var layer = feature.getLayer();

            // Checking the correct layer is being targeted
            console.log("LAYER", layer);

            // Checking the feature shows the correct edits
            console.log('FEATURE', feature);

            // Check there's an objectid field
            console.log('obid', feature.attributes.OBJECTID);

            // Look at the update results
            on.once(layer, 'edits-complete', function(re) {
                console.log("Successful update?", re.updates[0].success);
                attIn.refresh();
                layer.refresh();
                saveClickDeferred.resolve('Done');
            });

            var updateDeferred = layer.applyEdits(null, [feature], null);  
            return saveClickDeferred.promise;
        }

Outcomes