Reputation: 11
Hello I keep getting the following error when going to a admin page
PHP Fatal error: Call to a member function setSaveParametersInSession() on a non-object in app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php on line 66
Here is my controller:
class LTS_Categorymove_Adminhtml_BlacklistController extends Mage_Adminhtml_Controller_Action{
public function indexAction(){
$this->loadLayout();
var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());
$this->renderLayout();
}
}
Here is my main block:
class LTS_Categorymove_Block_Adminhtml_Main extends Mage_Adminhtml_Block_Widget_Grid_Container{
protected $_addButtonLabel = 'Add New Example';
public function __construct(){
//error_log('fgboo');
$this->_controller = 'adminhtml_main';
$this->_blockGroup = 'categorymove';
$this->_headerText = 'Blacklist';
$this->_addButtonLabel = 'Button Here';
parent::__construct();
}
protected function _prepareLayout(){
$this->setChild( 'grid',
$this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . '_grid',
$this->_controller . '.grid')->setSaveParametersInSession(true) );
return parent::_prepareLayout();
}
}
Now when I have googled the issue everyone keeps saying its a incorect _controller declration but from reading around they say that i should be using the block name which I am. Any help would be awesome thanks
Upvotes: 1
Views: 2437
Reputation: 61
Check your folder structure one more time to make sure that all the files are located at correct path.
In my case for this issue the file was placed at wrong location. I placed the Grid.php
in controller/Adminhtml
folder rather than Block/Adminhtml/<modulename>/Grid.php
Upvotes: 2