Skip to main content
edited tags
Link
Fabian Schmengler
  • 66.1k
  • 25
  • 188
  • 422
Source Link
Nickool
  • 1.1k
  • 3
  • 16
  • 38

how to assign the same value to column of custom grid?

I want to assign the same text to one column of all rows of the Grid

I have my custom grid and I added column like this:

class Ailin_Orders_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
{  //somecode
     protected function _prepareColumns()
        {
            $helper = Mage::helper('ailin_orders');
            $this->addColumn('Vendor Code',
                array(
                    'header'=> Mage::helper('catalog')->__('Vendor Code'),
                    'width' => '50px',
                    'renderer'  => 'adminhtml/sales_render'
            ));
}
}

I created a file render.php to render the value simply like this:

class Ailin_Orders_Block_Adminhtml_Sales_Render
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {
        return "SCOZAH";
    }
}

enter image description here