Mage/Adminhtml/Widget/Grid/Column/Renderer/Concat.php -- can someone please provide an example of its usage? For instance, can it be used in place of:
$this->addColumn('order_item', array(
'header'=> $this->__('Order # (Item #)'),
'sortable'=> true,
'index'=> 'order_item',
'filter_index'=> "CONCAT(orders.increment_id, ' (', main_table.item_id, ')')",
'width'=> '140px',
));
Thanks Simon! The addColumn renderers are cased out in Mage_Adminhtml_Block_Widget_Grid_Column::_getRendererByType() so it is not necessary to manually add it although that is very cool to know. I still had issues if I left off the filter index, but I did clean up the code to this:
$this->addColumn('order_item',
array(
'header' => $this->__('Order # -- Item #'),
'sortable' => true,
'index' => array('increment_id', 'item_id'),
'type' => 'concat',
'separator' => ' -- ',
'filter_index' => "CONCAT(orders.increment_id, ' -- ', main_table.item_id)",
'width' => '140px',
)
);
I think it should be used like every renderer in renderer
. The columns to be concatenated can be set in an array in index
. I think it's not possible to use separators
like you want to. It tested in product grid:
$this->addColumn('entity_id',
array(
'header'=> Mage::helper('catalog')->__('ID'),
'index' => array('entity_id','sku'),
'separator'=>'|',
'renderer' => 'adminhtml/widget_grid_column_renderer_concat',
));
We can merge two columns in Grid using below method.
$this->addColumn('name', array(
'header' =>Mage::helper('customreport')->__('Name'),
'sortable' =>true,
'index' =>array('firstname', 'lastname'),
'type' =>'concat',
'separator' =>' '
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With