AnsweredAssumed Answered

Why won't apply edits update, but adding a new point will for Features?

Question asked by csergent08 Champion on May 22, 2015
Latest reply on May 27, 2015 by csergent08

My application will create new feature points, but will not update existing points. Is there different syntax besides the applyEdits to perform an update? I have debugged and the attributes are there when I start. They just don't take, which is why I thought my syntax may be wrong.

 

Here is a block of code that I am trying to use for one of the updates:

 // get sign attributes from form and submit
    var updateSigns = function () {


        // alert(domClass.contains("attributesSignModal", "in"));


        var attributes = {
            // TODO: not sure if this is needed  
            //requestreceived: null
        };
        var currentDate = new Date(); // current date is defined but never used.
        var graphic;




        graphic = new Graphic(app.currentGeometry);


        query("#attributesSignModal input, #attributesSignModal select, #attributesSignModal textarea").forEach(function (formInput) {
            attributes[formInput.name] = formInput.value;
        });


        // Form validation - ensures that the values for the data are here if left blank
        if ((attributes.installed === undefined) || (attributes.installed === "")) {
            attributes.installed = null;
        }
        if ((attributes.signId === undefined) || (attributes.signId === "")) {
            attributes.signId = null;
        }
        if ((attributes.supportId === undefined) || (attributes.supportId === "")) {
            attributes.supportId = null;
        }


        graphic.setAttributes(attributes);
        stopCaptureRequest();


        console.log(attributes);
        app.signLayer.applyEdits(null, [graphic], null).then(function (response) {
            console.log(response);
            app.signLayer.refresh();


        });


    };

and here is an addSign that does work:

 // get sign attributes from form and submit
    var addSigns = function () {


       // alert(domClass.contains("attributesSignModal", "in"));


        var attributes = {
            // TODO: not sure if this is needed  
            //requestreceived: null
        };
        var currentDate = new Date(); // current date is defined but never used.
        var graphic;




        graphic = new Graphic(app.currentGeometry);


        query("#attributesSignModal input, #attributesSignModal select, #attributesSignModal textarea").forEach(function(formInput) {
            attributes[formInput.name] = formInput.value;
        });


        // Form validation - ensures that the values for the data are here if left blank
        if ((attributes.installed === undefined)|| (attributes.installed === "")) {
            attributes.installed = null;
        }
        if ((attributes.signId === undefined) || (attributes.signId === "")) {
            attributes.signId = null;
        }
        if ((attributes.supportId === undefined) || (attributes.supportId === "")) {
            attributes.supportId = null;
        }


        graphic.setAttributes(attributes);
        stopCaptureRequest();


        console.log(attributes);  
        app.signLayer.applyEdits([graphic], null, null).then(function (response) {
            console.log(response);
            app.signLayer.refresh();
            
        });


    };

and finally, here is my latest github commit:

csergent45/streetSigns at 787b3ed59a446ca1cfcb8229d696b3445c4dda59 · GitHub

Outcomes