When I try to load my custom grid view in the admin page, I got a blank page with the default admin layout loaded in instead of my grid. I tried many things but I can't find the bug.
My controller is implemented as follows:
<?php
class Brain2Terminal_CertWizard_Adminhtml_CertinfoController extends Mage_Adminhtml_Controller_Action
{
public function indexAction() {
$this->loadLayout();
$this->_setActiveMenu('sales/sales');
$this->_addContent($this->getLayout()->createBlock('CertWizard/adminhtml_certinfo'));
$this->renderLayout();
}
}
Grid container:
<?php
class Brain2Terminal_CertWizard_Block_Adminhtml_Certinfo extends
Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
parent::__construct();
$this->_controller = "adminhtml_certinfo";
$this->_blockGroup = "CertWizard";
$this->_headerText = Mage::helper ( 'flexibleforms' )->__ ( 'Manage Infos' );
$this->_addButtonLabel = Mage::helper ( 'CertWizard' )->__ ( 'Add Info' );
}
protected function _prepareLayout()
{
$this->setChild( 'grid', $this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . '_grid', $this->_controller . '.grid')->setSaveParametersInSession(true) );
return parent::_prepareLayout();
}
}
The Grid:
<?php
class Brain2Terminal_CertWizard_Block_Adminhtml_Certinfo_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId("certinfoGrid");
$this->setDefaultSort("id");
$this->setDefaultDir("ASC");
$this->setUseAjax(true);
$this->setSaveParametersInSession(true);
}
protected function _prepareCollection()
{
$collection = Mage::getModel("CertWizard/certinfo")->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn("id", array(
"header" => $this->__("ID"),
"align" => "right",
"width" => "30px",
"type" => "number",
"index" => "id",
));
$this->addColumn("attributeset_id", array(
"header" => $this->__("Attributeset"),
"align" => "right",
"width" => "50px",
"type" => "varchar",
"index" => "attributeset_id",
));
$this->addColumn("info", array(
"header" => $this->__("Info"),
"align" => "right",
"width" => "50px",
"type" => "varchar",
"index" => "info",
));
return parent::_prepareColumns();
}
}
If any more information is needed, please let me know.
So my layout.xml file looks like follows:
<layout>
<adminhtml_certinfo_index>
<reference name="content">
<block type="CertWizard/adminhtml_certinfo" name="certinfo" />
</reference>
</adminhtml_certinfo_index>
</layout>
Like you said i added a node with prefixing adminhtml_
in addition i refer to the correct block. When i debug everything is fine and block is also called without problems. Certainly i'm getting no gridview. Why?
Once again I've debugged the part where the the controller loads the layout and put the method
var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());
die();
after loadLayout()
.
The result was
array (size=4)
0 => string 'default' (length=7)
1 => string 'STORE_admin' (length=11)
2 => string 'THEME_adminhtml_default_MAG100207_MobileStore/' (length=46)
3 => string 'adminhtml_certinfo_index' (length=24)
But still I can't find the bug.