jzahedieh
jzahedieh

Reputation: 1579

Magento: addColumn option to give admin grid <td> identifier

I am trying to add an identifier to a column in my custom reports admin html grid view so I can manipulate the background colour with Javascript.

$this->addColumn('qty_ordered', array(
    'header'    => Mage::helper('report')->__('Qty'),
    'sortable'  => false,
    'filter'    => false,
    'type'      => 'number',
    'index'     => 'qty_ordered'
))

So I have tried to add the following options to no avail:

'identifier'    => 'qtytest'
'id'            => 'qtytest'

If someone knows an option that can do this it would be great.

Also I can't seem to find a good resource to find $column options.

Thanks SO.

Upvotes: 2

Views: 2491

Answers (1)

FlorinelChis
FlorinelChis

Reputation: 1478

Mage_Adminhtml_Block_Widget_Grid::addColumn does the following:

public function addColumn($columnId, $column)
    {
        if (is_array($column)) {
            $this->_columns[$columnId] = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
                ->setData($column)
                ->setGrid($this);
        }

That meas it creates the block with the class: Mage_Adminhtml_Block_Widget_Grid_Column so, evrika, this class contains all the documentation you need.

Looking at Mage_Adminhtml_Block_Widget_Grid_Column::getCssClass it seems you can specify a css class using:

'column_css_class'    => 'your_css_class_here'

If you want your custom logic to display the data, you can always use a custom renderer for your column.

Upvotes: 4

Related Questions