AnsweredAssumed Answered

toggle measurement dijit (startup & destroy)

Question asked by paulj82 on Oct 23, 2011
Latest reply on Aug 2, 2015 by Amoor_38
Hello!

I have an issue with toggling the measurement widget: the first time i start the measurement it shows up and works correctly. Also destroying it works. But when I want to activate it another time the Div won't be displayed. What am I doing wrong?

var measurement;
...
if ((++clickcounter%2) == 0) {
  measurement.destroy();
} else {      
  if (measurement == undefined) {
    measurement = new esri.dijit.Measurement({
        map: map,
               defaultAreaUnit: esri.Units.SQUARE_METERS,
        defaultLengthUnit: esri.Units.KILOMETERS
             }, dojo.byId('measurementDiv'));

    measurement.startup();  
  } 

  measurement.setTool("distance", true);
}
...
<div id = "measurementDiv"></div>

Outcomes