title: Extjs 4.0 MVC - how to close a view from within the controller?
body: <p>I have a simple example here with a modal window that is a 'view'.  I want to have a button within the window that does a window close, so the lazy user doesn't need to click the 'X' in top right.</p>
  
  <p>My problem is I don't know how to reference the view from within the controller.  In the non-MVC world I would just do a 'window.close()' in the button handler.  Any ideas?  Thanks!</p>
  
  <p><strong>View</strong></p>
  
  <pre><code>   Ext.define('AM.view.testwindow.window', {
      extend: 'Ext.window.Window',
      alias: 'widget.TESTwindow',
      title: 'TEST Window',
      layout: 'border',
      width: 1000, height: 400,
      minimizable: true,
      maximizable: true,
      closeAction: 'destroy',
      initComponent: function () {
          this.items = [
  
          {xtype: 'gridpanel', region: 'center',    // grid in the window
          store: 'Equipments',
          columns: [
            { text: 'Equip ID',  dataIndex: 'EquipmentID' }
            , {  text: 'StationID',     dataIndex: 'StationID' }
          ],
  
          dockedItems: [{
              xtype: 'toolbar',         // Grid's toolbar
              items: [
              {
                    xtype: 'button',              /* Close button to close the window */
                    text: 'Close Window',
                    itemId: 'btnTestClose'
                }
             ]
          }
        ]
      }
      ];
      this.callParent(arguments);
  }
  }); 
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>  Ext.define('AM.controller.testwindow', {
      extend: 'Ext.app.Controller',
      stores: ['Equipments', 'Stations'],
      models: ['Equipment'],
      views: ['testwindow.window', 'testwindow.Grid'],
      refs: [
      {        ref: 'TESTgrid',     selector: 'TESTgrid'   },
          {    ref: 'testwindow',   selector: 'testwindow'  }
      ],
  
      init: function () {
  
          this.control(
          {
              '#btnTestClose': {
                  click: function (butt, e, options) {
                      alert('close handler!');
                      this.getTestwindowWindowView().close();   // this fails.   What should I do? ComponentQuery ?
                   }
              }
  
          }
          )
      }
  }
  );
  </code></pre>
  
  <p>Scope of 'this' from within Button handler</p>
  
  <p><img src="https://i.stack.imgur.com/WXiGJ.png" alt="Scope of &#39;this&#39; from within Button handler"></p>