title: How can I call another extjs panel from my current panel?
body: <p>I have two Panels and I want to call one panel from the other one.  I would like to destroy the first panel and render the second panel right where the first panel was.  Is this the correct way to do that?</p>
  
  <pre><code>function create(){
    var testButton = new Ext.Button({
      text: 'Switch panel',
      handler: function(){
        Ext.getCmp('backgroundForm').destroy();
        upload();
      }
    });
  
    var backgroundForm = new Ext.Panel({
      id: 'backgroundForm',
      renderTo: 'mainPackage',
      autoHeight: true,
      buttons: [testButton]
    });
  }
  
  function upload(){
    var testButton = new Ext.Button({
      text: 'Switch panel',
      handler: function(){
        alert('Test');
      }
    });
  
    var backgroundForm = new Ext.Panel({
      id: 'newBackgroundForm',
      renderTo: 'mainPackage',
      autoHeight: true,
      button[newTestButton]
    });
  }
  </code></pre>