According to the documentation (https://developers.arcgis.com/en/javascript/jsapi/measurement.html), clearResult() is indeed a method that should remove the graphics (apparently it was added in v2.4). My application is using the 3.5compact version of the API, so why would the browser tell me clearResult() is not a function? I am completely stumped here.
function clickHandler() { measureDialog.clearResult(); }
When the user clicks the element with class "imgOptions", I still get the same message: "TypeError: measureDialog.clearResult is not a function"...Am I just using the wrong version of the API? Here's my script reference:
I wrongfully assumed measureDialog was a reference to the dijit from lack of context. A reference to the dijit is not the same thing as a reference to its domNode.
I initially wasn't thinking in terms of variable scope, but thanks to you and others now I do have most of the functionality working the way I need it. However, there is still one oddity left that I'm wondering about:
Even after using the setTool and clearResult methods as shown in the API reference (https://developers.arcgis.com/en/javascript/jsapi/measurement.html), the small flag graphic is still showing on the map after clicking on an adjacent parcel to the one the user was originally trying to measure.
imgOptions is the class of the widget image the user clicks to show/hide the measurement widget. Also, can anyone explain exactly what the destroy() method does? Maybe it's just me, but the description "Destroy the measurement widget." is a little ambiguous.
and destroy should delete the widget DOM elements and remove it from the dijit registry. This is necessary if you ever want to re-instatiate the widget with the same name/id