AnsweredAssumed Answered

Referencing nodes in widget.html

Question asked by jperkins_CPU on Jun 4, 2019
Latest reply on Jun 5, 2019 by jperkins_CPU

Hello, 

I'm working in WAB 2.12. I'm not sure why this wouldn't work, and I was hoping someone could point me in the right direction. I want a dialog box upon opening the widget, and I'm placing the button markup for the dialog box in widget.html, but i thought you were supposed to be able to reference the HTML via the data-dojo-attach-point. When my dialog box opens, it's empty. Do you know what I'm missing?

 

Widget.html

<div>
<div data-dojo-attach-point="myTemp" data-dojo-type="dijit/Dialog" title="My Title">
    <button class="btn" data-dojo-type="dijit/form/Button" type="button">Button1 </button>
    <button class="btn" data-dojo-type="dijit/form/Button" type="button">Button3</button>
    <button class="btn" data-dojo-type="dijit/form/Button" type="button">Button2</button>
</div>
</div>

 

and Widget.js

define(['dojo/_base/declare',
    'dojo/_base/lang',
    "dijit/_WidgetsInTemplateMixin",
    'jimu/BaseWidget',
    "dijit/form/Button",
    "dijit/Dialog",
    "dojo/dom",
    'dojo/on',
    "esri/lang",
    "dojo/domReady!"
  ],
  function (declare,
    lang,
    _WidgetsInTemplateMixin,
    BaseWidget,
    Button,
    Dialog,
    dom,
    on,
    esriLang,

    ) {
    return declare([_WidgetsInTemplateMixin, BaseWidget], {

      baseClass: 'jimu-widget-myWidget',
     
      onOpen: function () {
        this.inherited(arguments);
        console.log('onOpen');

          this.myDialog = new Dialog({
            title: this.title,
            content: this.myTemp
          })
          this.myDialog.show();
    
        },

Outcomes