1

Scenario I'm overriding a grid and in the _prepareColumns() I would like to replace a column renderer with custom one.

Because the column already exist I'm using getColumn() and the setRenderer() method, the issue is that this action is breaking the backend page.

I cannot find any exception/report/log ... so I'm a bit lost.

here the code

 protected function _prepareColumns()
    {
        parent::_prepareColumns();
        $this->getColumn('in_products')
            ->setRenderer('MYMODULE/catalog_product_edit_tab_super_config_grid_renderer_checkbox');

        return $this;
    }
4
  • Are you sure the column is named in_products? Try dumping the value of $this->getColumn('in_products') to see whether you're attempting to call ->setRenderer() on a non-object. Commented Aug 7, 2014 at 17:14
  • in_product is right, xdebug ..
    – Fra
    Commented Aug 7, 2014 at 17:48
  • 1
    Is the path to the custom renderer is correct?
    – Amasty
    Commented Aug 7, 2014 at 18:56
  • yes it is correct
    – Fra
    Commented Aug 8, 2014 at 11:22

1 Answer 1

2

Late answer but maybe useful for someone

i have used setData('renderer', '...') instead of setRenderer('...')

this is from observer

$block->getColumn('column_name')->setData('renderer','MyName_MyModule_Block_Adminhtml_Grid_Renderer_Denied');

and Denied.php

<?php
class MyName_MyModule_Block_Adminhtml_Grid_Renderer_Denied extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {
        return 'some html here';
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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