Fatal error: calling setColumn () member function for non-object in Magento

Fatal error: calling setColumn () member function for non-object in D: \ Program Files \ wamp \ www \ magento \ app \ code \ core \ Mage \ Adminhtml \ Block \ Widget \ Grid \ Column. php on line 291

in the admin grid section I used column data

protected function _prepareColumns() { $this->addColumn('giftcard_id', array( 'header' => 'ID', 'align' => 'right', 'width' => '50px', 'index' => 'giftcard_id', )); $this->addColumn('giftcard_id', array( 'header' => 'Detail', 'align' => 'center', 'width' => '150px', 'renderer' => 'giftcard/adminhtml_giftcard_idrenderer', 'index' => 'giftcard_id', )); $this->addColumn('created_time', array( 'header' => 'Creation Time', 'align' => 'left', 'width' => '120px', 'type' => 'date', 'default' => '--', 'index' => 'created_time', )); $this->addColumn('update_time', array( 'header' => 'Update Time', 'align' => 'left', 'width' => '120px', 'type' => 'date', 'default' => '--', 'index' => 'update_time', )); $this->addColumn('status', array( 'header' => 'Status', 'align' => 'left', 'width' => '80px', 'index' => 'status', 'type' => 'options', 'options' => array( 1 => 'Active', 0 => 'Inactive', ), )); $this->addColumn('action', array( 'header' => Mage::helper('giftcard')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('giftcard')->__('Delete'), 'url' => array('base'=>'*/*/delete'), 'field' => 'id' ) ), 'filter' => false, 'sortable' => false, 'is_system' => true, )); return parent::_prepareColumns(); } 

in giftcard / adminhtml_giftcard_idrenderer I used the following code

 class Troy_Giftcard_Block_Adminhtml_Giftcard_Idrenderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract { public function render(Varien_Object $row) { $value = $row->getData($this->getColumn()->getIndex()); $html = 'testing-'.$value .'-testing'; return $html; } } 

I got this error when I use

 $this->addColumn('giftcard_id', array( 'header' => 'Detail', 'align' => 'center', 'width' => '150px', 'renderer' => 'giftcard/adminhtml_giftcard_idrenderer', 'index' => 'giftcard_id', )); 

anyone can help me how to fix it

Preliminary thanks

+4
source share
3 answers

Probably the renderer class not found. try

'renderer' => 'troy_giftcard / adminhtml_giftcard_idrenderer',

+5
source

This is due to Magento throwing an exception for the renderer class as an Invalid block for it.

Example: 'renderer' => 'Custom_Sales_Block_Adminhtml_Report_Sales_Grid_Column_Renderer_Status' average value over the class is not a valid block due to incorrect path or layout mismatch.

+2
source

My problem was inside a custom column renderer.

I have enabled HTML tags in the 'description' attribute. That would be nice, but I added a column using the "description" value truncated. This opened the HTML element tag, but truncated the closing tag. Thus, the destruction of my product catalog grid.

The JavaScript errors that I saw in the AdminHtml directory product grid were:

 productGridJsObject not defined 

PHP errors that I saw when turning on / off my module:

 Fatal error: Call to a member function setColumn() on a non-object in /home/www-data/magento/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php on line 291 

Resolution: Was in my usual renderer; to handle my truncated "description" of the value using PHP htmlentities (), so the opening tag will not be considered a DOM object.

0
source

All Articles