user1739825
user1739825

Reputation: 820

Dojo1.8: _WidgetBase does not sound good to me

Hi It seems that using _WidgetBase is is a bad idea to use. What I was looking for is that I can make instances (with different properties from the class button).

require(["dojo/_base/declare", "dojo/dom","dojo/dom_construct", "dijit/_WidgetBase", dojo/domReady!],
    function(declare, dom, domConstruct, _WidgetBase)
     {
      ready(function()
      {
        declare("myBtn", [_WidgetBase],
          {buildRendering: function()
    {
             this.domNode = domConstruct.create('button');
    }
      });

        registry.byId(new myBtn(
          {id:'btn1',
           label:'HelloA'                            
      }).placeAt(dom.byId('line1')));

        registry.byId(new myBtn(
          {id:'btn2',
           label:'HelloB'                            
      }).placeAt(dom.byId('line2')));

        registry.byId(new myBtn(
          {id:'btn3',
           label:'HelloC'                            
      }).placeAt(dom.byId('line3')));

      }
     });

So I am wondering if it is okay to use _WidgetBase, when I wanted to add different properties for each button?

Upvotes: 0

Views: 104

Answers (1)

Erikas Zuzevicius
Erikas Zuzevicius

Reputation: 134

I am not sure if I understand your issue, while you can just use dijit/form/button (http://dojotoolkit.org/api/1.8/dijit/form/Button). If the button is just an example and you still need to extend _WidgetBase - answer to your question is yes, it is ok to use it, but there's a bit more code to write to make it configurable and flexible.

Upvotes: 1

Related Questions