Calculating acres from Edit Widget pop-up window

2633
0
04-01-2016 11:45 AM
Labels (1)
RobertMueller_Jr1
New Contributor III

I am trying to allow a user to calculate geometry for a predefined field from the Edit widget pop-up window using the ESRI JS geometryEngine. So far I've added a button to the Edit widget pop-up (in place of the close button), and assigning a variable to the selected features. However, Firebug tells me there is an error on this line in the geometryengine.js

                   

                    var CalcAcres=geometryEngine.geodesicArea(SelectedPoly, "acres")

Anyone have an idea on what's going on? My current thinking is that I'm doing to much in the "addButtonToInspector" and need to move the calculation somewhere outside this function

  _addButtonToInspector: function() {

        /*var closeButton = new Button({

          label: esriBundle.common.close,

          "class": " atiButton closeButton"

        }, html.create("div"));

        */

       

        //Swapping out the CalcAcresButton for the "close" button

        var CalcAcresButton = new Button({

          label: "Calculate Acres",

          "class": " atiButton CalcAcresButton"

        }, html.create("div"));

       

        html.place(CalcAcresButton.domNode,

                   this.editor.attributeInspector.deleteBtn.domNode,

                   "after");

        this.own(on(CalcAcresButton, 'click', lang.hitch(this, function() {

       

                //Get Selected polygon

              var SelectedPoly = this.map.infoWindow.getSelectedFeature();

              //Calculate the acreage, store in avariable

              //Either "acres" or 109403

              var CalcAcres=geometryEngine.geodesicArea(SelectedPoly, "acres");

              //setting the value for the "Acres" field for with the calculated value

              featureLayer.setAttributes({"Acres":CalcAcres});

             //Applying the edits to the featurelayer

             this.featureLayer.applyEdits(null, [featureLayer], null);

         

        })));

      },

Tags (1)
0 Kudos
0 Replies