I'm building a widget where the user should be able to draw custom areas/polygons. I use the DrawBox dijit and limit the tools to "POLYGON" and "EXTENT" on creation (declarativ creation).
My html tag looks like this:
<div data-dojo-attach-point="drawBox" data-dojo-type="jimu/dijit/DrawBox" data-dojo-props='geoTypes:["POLYGON","EXTENT"],showClear:true,deactivateAfterDrawing:false' style="margin-top: 10px;"></div>
So far it's all good, but I also want to give the user the possibility to apply a buffer, and when the user checks a checkbox for applying buffer I want to modify the drawBox to allow the user to draw a polyline or point as well since the buffer will make it a polygon.
I've looked at the DrawBox.js and can't seem to find a suitable method for this, tried just change the value of this.drawBox.geoTypes but with no succes.
Anyone know if this is possible?
Solved! Go to Solution.
@MattiasEkström After you have set the geoTypes in code then you just have to call the _initTypes() method on the drawBox.
@MattiasEkström After you have set the geoTypes in code then you just have to call the _initTypes() method on the drawBox.
Thanks Robert! It works great!