AnsweredAssumed Answered

BUG: Measurement widget measure-end event issue.

Question asked by amarsden on Jul 28, 2014
Latest reply on Aug 27, 2015 by dustinn



II have a widget


    var measurement = new esri.dijit.Measurement({
        map: map,
        defaultAreaUnit: esri.Units.SQUARE_METERS,
        defaultLengthUnit: esri.Units.METERS
    }, dojo.byId('measurementDiv'));

    measurement.on("measure-end", function (evt) {
        console.debug("Really ended?")
        this.setTool(evt.activeTool, false);


Define as above.


However the measure-end event is fired after each node of an area measure from the third node onwards.  There follows a large error message


The task does, however keep going when area is being measured.


TypeError {stack: (...), message: "undefined is not a function"}


"TypeError: undefined is not a function at http://x/common/init.js?123:185:14 at null.<anonymous> (http://x/arcgis_js_api/library/3.10/3.10/init.js:777:175) at h.(anonymous function).g [as onMeasureEnd] (http://x/arcgis_js_api/library/3.10/3.10/init.js:239:390) at s._showArea (http://x/arcgis_js_api/library/3.10/3.10/js/esri/dijit/Measurement.js:35:330) at s._outputArea (http://x/arcgis_js_api/library/3.10/3.10/js/esri/dijit/Measurement.js:35:181) at null.<anonymous> (http://x/arcgis_js_api/library/3.10/3.10/init.js:173:473) at h.(anonymous function).g [as onAreasAndLengthsComplete] (http://x/arcgis_js_api/library/3.10/3.10/init.js:239:390) at e._successHandler (http://x/arcgis_js_api/library/3.10/3.10/init.js:490:174) at e._areasAndLengthsHandler (http://x/arcgis_js_api/library/3.10/3.10/init.js:916:267) at http://x/arcgis_js_api/library/3.10/3.10/init.js:174:23"



Strange?  Or my fault?







Using the older  dojo.connect


    dojo.connect(measurement, "onMeasureEnd", function (activeTool, geometry) {
        this.setTool(activeTool, false);


And the event fires, as before on the third click, for area, but doesn't have the error, and re-enables my ID task.


It looks like the new widget is firing the OnMeasureEnd event each time a result for the area is required - the old tool only got the result on double click - ending the drawing.


the code worked fine in 3.8 & 3.9