AnsweredAssumed Answered

I just want to use part of the drawbox dijit but cant call my function from the widget HTML

Question asked by hone_j on Aug 22, 2019
Latest reply on Sep 3, 2019 by hone_j

HI m making use of the drawbox dijit but I dont want my users to have access to all the drawing options.


After looking at the drawbox dijit it seems I just want to call "this.drawBox.activate('EXTENT')" then I can do stuff _onDrawComplete.


but Im not sure why I cant call my function from the HTML.


Hers my js, Im trying to call the grabArea function from my HTML

function(declare, BaseWidget, _WidgetsInTemplateMixin, html, lang, on, Drawbox) {
     var clazz = declare([BaseWidget, _WidgetsInTemplateMixin], {

          baseClass: 'jimu-widget-JimDrawbox',

          name: 'JimDrawbox',

          drawBox: null,

          _initStuff: function(){
             this.drawBox = new Drawbox;

           postCreate: function() {
             this.drawBox.types = ["EXTENT"];
             this.drawBox.keepOneGraphic = true;
             this.own(on(this.drawBox, 'DrawEnd', lang.hitch(this, this._onDrawComplete)));


           grabArea: function() {

           _onDrawComplete: function(graphic) {
                var geometry = graphic.geometry;



And here's my HTML

     <button class ="button" onclick="this.grabArea()">Click to draw extent</button>

I just keep getting


Uncaught TypeError: this.grabArea is not a function
at HTMLButtonElement.onclick


So it seems my grabArea function isnt visible to the HTML at that point, but I'm not sure why.

JS isnt my main language so Im struggling a bit to resolve it.

Finding WAB one of the hardest frameworks I've come across to decipher so far...