1

I am developping a web application with arcgis javascript api. I am using arcgis server 10.2. I declared a featureLayer, the URL of this featureLayer is a feature service on my server. Using a geoprocessing service, I am able to create features from the results of the service. I am able to add the features to the featureLayer I declared and show them in the map, but the problem is the changes made are not saved on the server. this is the code sample:

 function displayResults(results, messages) {
    var flayer = new esri.layers.FeatureLayer("http://hamri-pc:6080/arcgis/rest/services/edt/FeatureServer/0", {
      mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
      outFields: ['*']
    });  
    var features = results[0].value.features;
    var theExtent = null;
    for (var f = 0, fl = features.length; f < fl; f++) {
        var feature = features[f];
        var attribs = feature.attributes;
            feature.setSymbol(normalpictureMarkerSymbol);
            feature.setInfoTemplate(infoTemplate);
                            flayer.add(feature);
                      flayer.applyEdits(feature,null,null);
                            map.addLayers([flayer]);
        }
    }

Does anyone have an idea of what should I do to save the features in the server?

2

Change this line

flayer.applyEdits(feature,null,null);

to

flayer.applyEdits(null, [feature], null);
  • Thank you for your comment. My problem is solved now I used flayer.applyEdites([feature],null,null); – Hamri Said May 24 '14 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.