title: Adding items to Sencha Touch Panel through the Constructor
body: <p>I'm trying to add items to a Sencha Touch (2.0) panel child class from the constructor. The code below:</p>
  
  <pre><code>    Ext.define("MyApp.view.Icon", {
          extend: "Ext.Panel",
          config: {
              layout: "vbox" //ensures caption appears directly below image
          },
          constructor: function(cfg) {
              this.add(
                  //First we add the icon image
                  {
                     xtype: "image",
                     src: cfg.src,
                     width: cfg.width,
                     height: cfg.height
                  },
                  //Then we add the icon caption
                  {
                     xtype: "panel",
                     html: cfg.caption
                  }
              );
              return this;
          }
      });
      var anIcon = Ext.create("MyApp.view.Icon", {
                                               src: "http://placehold.it/80", 
                                               width: 100,
                                               height: 100,
                                               caption: "My Icon"});
  </code></pre>
  
  <p>Doing this gives me the error: </p>
  
  <p><code>Uncaught TypeError: Cannot call method 'has' of null</code></p>
  
  <p>And it appears to originate from <code>this.add()</code>. I have also tried <code>this.self.add()</code>, which also doesn't work. Is there no way to insert elements from the constructor?</p>