var measurement = new esri.dijit.Measurement({ map: map }, dojo.byId('measurement')); measurement.deactivate = function() { var locationBtn = dijit.byId('location'), distanceBtn = dijit.byId('distance'), areaBtn = dijit.byId('area') this.closeTool(); locationBtn.setAttribute('checked', false); distanceBtn.setAttribute('checked', false); areaBtn.setAttribute('checked', false); }
I have written the following hacked together function which will deactivate the measurement widget. Calling measurement.deactivate() will deselect any selected function and return to the usual map tools. Hope it's useful to others.var measurement = new esri.dijit.Measurement({ map: map }, dojo.byId('measurement')); measurement.deactivate = function() { var locationBtn = dijit.byId('location'), distanceBtn = dijit.byId('distance'), areaBtn = dijit.byId('area') this.closeTool(); locationBtn.setAttribute('checked', false); distanceBtn.setAttribute('checked', false); areaBtn.setAttribute('checked', false); }
<div id="floater"> <div id="measureDiv"></div> </div>
meas = dijit.byId('measureTool'); if (meas) { meas.destroy(); }
var measure = new esri.dijit.Measurement({ map: currentmap, id: 'measureTool' }, dojo.create('measurement')); dojo.place(measure.domNode,dojo.byId('measureDiv'));
for those who still haven't find any solution for this, and problems like that, here's what I've done.
you can simply simulate the CLICK trigger which deactivates the activated task, or whatever.
use dojo query to target the activated element, then .click() on it.
measurementActiveButton = dojo.query(".esriMeasurement .esriButton.esriButtonChecked .dijitButtonNode")[0] if(measurementActiveButton){ measurementActiveButton.click(); }
hope you find it helpful.
cheers developers