title: ExtJS 4 Loading data into form panel on creation. Which event to catch?
body: <p>I'm stuck with populating <code>Ext.form.Panel</code> with data in my MVC project. In Controller I want to load data from store into form. But I cannot access basic form via form panel.</p>
  
  <p>Form view</p>
  
  <pre><code>Ext.define('Example.view.webitem.Form', {
      extend: 'Ext.form.Panel', 
      alias: 'widget.webitemform',
      renderTo: 'webstructure-form',
  
      items: [{
          xtype: 'fieldset',
          title: 'Metadata',
          items: [{
              xtype: 'displayfield',
              name: 'id',
              fieldLabel: 'ID'
          },
          {
              xtype: 'textfield',
              name: 'name',
              fieldLabel: 'Name'
          }]
      }],
      buttons: [{
          text: 'Load',
          action: 'loaditem'
      }]
  });
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>Ext.define('Example.controller.WebItemsForm', {
      extend: 'Ext.app.Controller',
  
      stores: ['WebItemsForm'],
      models: ['WebItem'],
      views: ['webitem.Form'],
      init: function() {
          // This does not work. Data aren't loaded in store
          this.control({
              'webitemform': {
                 render: this.loadItem
              }
          });
          // This works, but isn't userfriendly
          this.control({
              'webitemform button[action=loaditem]': {
                  click: this.loadItem
              }
          });
      },    
      loadItem: function() {
          var form = this.getWebItemForm().getForm();
          var data = this.getStore('WebItemsForm').getAt(0);
          form.loadRecord(data);
      }
  });
  </code></pre>
  
  <p>After clicking on <code>Load</code> button, data are correctly loaded into form. But when I'm trying to catch <code>Ext.form.Panel render</code> event, store doesn't have data loaded. </p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'data' of undefined. 
  </code></pre>
  
  <p>If I understand correctly, this is caused because load operation is asynchronous? <strong>How to load data on render event? Is there more suitable event?</strong></p>