title: Magento custom module grid not displaying
body: <p>So I'm trying to get a grid to display in my custom module (displaying anything for the time being, I'll worry about the collection once it's working!). </p>
  
  <p>The problem is that the _prepareCollection() and/or _prepareColumns() methods of my grid widget class never seem to get called and the grid never shows (nor do the buttons and header text). (The Magento admin header and footer and navigation display correctly. It's just blank in the middle!)</p>
  
  <p>This is what I have so far:</p>
  
  <p>app/code/local/MyNamespace/Mymodule/etc/config.xml</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;config&gt;
      &lt;modules&gt;
          &lt;MyNamespace_Mymodule&gt;
              &lt;version&gt;0.0.1&lt;/version&gt;
          &lt;/MyNamespace_Mymodule&gt;
      &lt;/modules&gt;
      &lt;!-- Define frontend and backend routers --&gt;
      &lt;admin&gt;
          &lt;routers&gt;
              &lt;mymodule&gt;
                  &lt;use&gt;admin&lt;/use&gt;
                  &lt;args&gt;
                      &lt;module&gt;MyNamespace_Mymodule&lt;/module&gt;
                      &lt;frontName&gt;mymodule&lt;/frontName&gt;
                  &lt;/args&gt;
              &lt;/mymodule&gt;
          &lt;/routers&gt;
      &lt;/admin&gt;
      &lt;!-- /Define frontend and backend routers --&gt;
      &lt;global&gt;
          &lt;helpers&gt;
              &lt;mymodule&gt;
                  &lt;class&gt;MyNamespace_Mymodule_Helper&lt;/class&gt;
              &lt;/mymodule&gt;
          &lt;/helpers&gt;  
          &lt;blocks&gt;
              &lt;mymodule&gt;
                  &lt;class&gt;MyNamespace_Mymodule_Block&lt;/class&gt;
              &lt;/mymodule&gt;
          &lt;/blocks&gt;
      &lt;/global&gt;
      &lt;adminhtml&gt;
          &lt;menu&gt;
              &lt;mymodule module="mymodule"&gt;
                  &lt;title&gt;My Module&lt;/title&gt;
                  &lt;sort_order&gt;80&lt;/sort_order&gt;              
                  &lt;children&gt;
                      &lt;items module="mymodule"&gt;
                          &lt;title&gt;Manage My Module&lt;/title&gt;
                          &lt;sort_order&gt;0&lt;/sort_order&gt;
                          &lt;action&gt;mymodule/adminhtml_mymodule&lt;/action&gt;
                      &lt;/items&gt;
                  &lt;/children&gt;
              &lt;/mymodule&gt;
          &lt;/menu&gt;
         &lt;!-- define layout updates --&gt;
          &lt;layout&gt;
              &lt;updates&gt;
                  &lt;mymodule&gt;
                      &lt;file&gt;mymodule.xml&lt;/file&gt;
                  &lt;/mymodule&gt;
              &lt;/updates&gt;
          &lt;/layout&gt;
          &lt;!-- /define layout updates --&gt;
      &lt;/adminhtml&gt; 
  &lt;/config&gt;
  </code></pre>
  
  <p>Then my controller:</p>
  
  <p>app/code/local/MyNamespace/Mymodule/controllers/Adminhtml/MymoduleController.php</p>
  
  <pre><code>&lt;?php
  class MyNamespace_Mymodule_Adminhtml_MymoduleController extends Mage_Adminhtml_Controller_action
  {
      public function indexAction() {
          $this-&gt;getLayout()-&gt;createBlock('mymodule/adminhtml_mymodule');
          $this-&gt;loadLayout();
          $this-&gt;renderLayout();
      }
  }
  </code></pre>
  
  <p>Then in my grid container:</p>
  
  <p>app/code/local/MyNamespace/Mymodule/Block/Adminhtml/Mymodule.php</p>
  
  <pre><code>&lt;?php
  class MyNamespace_Mymodule_Block_Adminhtml_Mymodule extends Mage_Adminhtml_Block_Widget_Grid_Container
  {
      public function __construct()
      {
          echo  __METHOD__ . " (Line #" . __LINE__ . ")&lt;br/&gt;";
          parent::__construct();
          $this-&gt;_controller = 'adminhtml_mymodule';
          $this-&gt;_blockGroup = 'mymodule';
          $this-&gt;_headerText = Mage::helper('mymodule')-&gt;__('my header text'); // this is not rendered
          $this-&gt;_addButtonLabel = Mage::helper('mymodule')-&gt;__('my button text'); // this is not rendered
  
      }
  
      protected function _prepareLayout()
      {
          $this-&gt;setChild( 'grid',
              $this-&gt;getLayout()-&gt;createBlock( $this-&gt;_blockGroup.'/' . $this-&gt;_controller . '_grid',
              $this-&gt;_controller . '.grid')-&gt;setSaveParametersInSession(true) );
          return parent::_prepareLayout();
      }
  }
  </code></pre>
  
  <p>Then in my grid widget:</p>
  
  <p>app/code/local/MyNamespace/Mymodule/Block/Adminhtml/Mymodule/Grid.php</p>
  
  <pre><code>&lt;?php
  class MyNamespace_Mymodule_Block_Adminhtml_Mymodule_Grid extends Mage_Adminhtml_Block_Widget_Grid
  {
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;setId('mymoduleGrid');
          $this-&gt;setDefaultSort('id');
          $this-&gt;setDefaultDir('ASC');
          $this-&gt;setSaveParametersInSession(true);
      }
  
      protected function _prepareCollection()
      {
          echo  __METHOD__ . " (Line #" . __LINE__ . ")&lt;br/&gt;"; // This is never called
          $collection = Mage::getModel('catalog/product')-&gt;getCollection(); // just a temp collection for the time being
  
          $this-&gt;setCollection($collection);
          return parent::_prepareCollection();
      }
  
      protected function _prepareColumns()
      {
          echo  __METHOD__ . " (Line #" . __LINE__ . ")&lt;br/&gt;"; // This is never called
          $this-&gt;addColumn('id', array(
            'header'    =&gt; Mage::helper('mymodule')-&gt;__('ID'),
            'align'     =&gt;'right',
            'width'     =&gt; '10px',
            'index'     =&gt; 'id',
          ));
          return parent::_prepareColumns();
      }
  }
  </code></pre>
  
  <p>And finally my layout xml:</p>
  
  <p>app/design/adminhtml/default/default/layout/mymodule.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;layout version="0.1.0"&gt;
      &lt;adminhtml_mymodule_index&gt;
          &lt;reference name="content"&gt;
              &lt;block type="mymodule/adminhtml_mymodule" name="mymodule" /&gt;
          &lt;/reference&gt;
      &lt;/adminhtml_mymodule_index&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>There are no errors being shown in the logs and I'm now a bit stumpped and other SO answers don't seem to fit.</p>
  
  <p>Anyone shed any light on why my grid (even an empty one) isn't showing?</p>
  
  <p>Thank you.</p>
  
  <p><strong>EDIT</strong> Noticed that some classes had the wrong case (Mynamespace should be MyNamespace). Changed them but no difference</p>