Select to view content in your preferred language

Custom Identify Widget DrawBox onActivate throws drawToolBar null

1165
3
Jump to solution
02-08-2021 03:19 AM
Labels (1)
RichardReinicke
Frequent Contributor

Hello,

I'm new to Web AppBuilder custom widget programming and I try to modify the advanced identify widget by @RobertScheitlin__GISP as a learning project. 

I got the DrawBox tool inside my widget to show up in the widget panel and I want to make the DrawBox point draw function active on panelOpen. But when I click on the point draw icon

RichardReinicke1_0-1612782943945.png

it fails in DrawBox.js on this.drawToolBar.activate(tool); with drawToolBar being null.

I'm attaching my current state. What am I doing wrong? 

 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Richard,

  Your mistake is that you are decalring this.drawBox = new Drawbox. You can remove that line all together, since you have already declared that div to be a DrawBox in the html template.

 

      initDrawBox: function () {
	    //this.drawBox = new Drawbox;
        this.drawBox.setMap(this.map);
        this.drawBox.geoTypes = ['POINT'];
        this.drawBox._initTypes();
        this.drawBox.setPointSymbol(new SimpleMarkerSymbol(this.config.symbols.simplemarkersymbol));
        this.drawBox.deactivateAfterDrawing = false;
      },

 

View solution in original post

0 Kudos
3 Replies
RichardReinicke
Frequent Contributor

Please can someone have a look at my test widget 😕 ? The whole widget is attached.

Thank you very much

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Richard,

  Your mistake is that you are decalring this.drawBox = new Drawbox. You can remove that line all together, since you have already declared that div to be a DrawBox in the html template.

 

      initDrawBox: function () {
	    //this.drawBox = new Drawbox;
        this.drawBox.setMap(this.map);
        this.drawBox.geoTypes = ['POINT'];
        this.drawBox._initTypes();
        this.drawBox.setPointSymbol(new SimpleMarkerSymbol(this.config.symbols.simplemarkersymbol));
        this.drawBox.deactivateAfterDrawing = false;
      },

 

0 Kudos
RichardReinicke
Frequent Contributor

Thank you very much Robert. It's working as expected now.

0 Kudos