0

My container is loading, but I'm getting this error message:

Call to a member function setSaveParametersInSession() on boolean

Which from my searching shows that the grid file is not being loaded.

config.xml snippet

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <FactoryX_Careers after="Mage_Adminhtml">FactoryX_Careers_Adminhtml</FactoryX_Careers>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

controller

<?php

class FactoryX_Careers_Adminhtml_EmailController extends Mage_Adminhtml_Controller_Action {

    public function indexAction()
    {
        $this->loadLayout();
        $this->_setActiveMenu('factoryx_menu/send_emails');
        $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
        $this->_addContent($this->getLayout()->createBlock('careers/adminhtml_email'));

        $this->renderLayout();
    }

    public function gridAction()
    {
        $this->loadLayout();
        $this->getResponse()->setBody(
            $this->getLayout()->createBlock('careers/adminhtml_email_grid')->toHtml()
        );
    }
}

Container

<?php

class FactoryX_Careers_Block_Adminhtml_Email extends Mage_Adminhtml_Block_Widget_Grid_Container
{
    public function __construct()
    {
        $this->_controller = 'adminhtml_Email';
        $this->_blockGroup = 'careers';
        $this->_headerText = Mage::helper('careers')->__('Email Manager');

        parent::__construct();
        $this->_removeButton('add');
    }
}

Grid i havent really completed this file, I just want something to load

<?php
class FactoryX_Careers_Block_Adminhtml_Email_Grid extends Mage_Adminhtml_Block_Widget_Grid
{

    public function _construct()
    {
        parent::_construct();
        $this->setId('emailGrid');
        $this->setDefaultSort('id');
        $this->setDefaultDir(Varien_Data_Collection::SORT_ORDER_ASC);
        $this->setUseAjax(true);
        $this->setDefaultLimit(30);
    }

    public function getGridUrl()
    {
        return $this->getUrl('*/*/grid', array('_current'=>true));
    }

    public function getRowUrl()
    {
        return null;
    }

    protected function _prepareColumns()
    {
        $this->addColumn(
            'id',
            array(
                'header' => $this->__('Id'),
                'type' => 'number',
                'index' => 'id',
            )
        );
        $this->addColumn(
            'code',
            array(
                'header' => $this->__('Code'),
                'type' => 'text',
                'index' => 'code',
            )
        );
        $this->addColumn(
            'number',
            array(
                'header' => $this->__('Number'),
                'type' => 'number',
                'index' => 'number',
            )
        );
        $this->addColumn(
            'what',
            array(
                'header' => $this->__('Text'),
                'type' => 'text',
                'index' => 'text'
            )
        );
        $this->addColumn(
            'datelol',
            array(
                'header' => $this->__('Date'),
                'type' => 'date',
                'index' => 'date'
            )
        );
        $this->addColumn(
            'datetimelol',
            array(
                'header' => $this->__('Date Time'),
                'type' => 'datetime',
                'index' => 'datetime',
                'filter_time' => true,
            )
        );
    }

    public function getCollection()
    {
        if (is_null($this->_collection)) {
            $this->_collection = Mage::getResourceSingleton('convenient_admingrid/collection_disk');
        }
        return $this->_collection;
    }
}

From my searching people say that the grid block is not being found properly from the container. However, I think I've defined it properly, as my controller is in adminhtml folder and then email folder. And the blockgroup is meant to be the module name, the module actually already has another block and it has the same block group definitions which are working.

When I log the block from the core Collection.php file where the error is coming from, it gives me: "careers/adminhtml_Email_grid", which looks correct to me. Another block which is defined and is working is "careers/adminhtml_Careers_grid" which has all the same folder structure and everything.

0

I removed this function from my grid file and it somehow works, not really sure why.

public function getRowUrl()
    {
        return null;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.