Using How to create a custom grid from scratch article, I have created a custom order grid in Magento admin.
Previously I had added one custom column with name 'my_data' in sales_flat_order
table.
Now, to display data from this column in Order Grid, I have added following code:
$this->addColumn('my_data', array(
'header' => $helper->__('My Data'),
'index' => 'my_data',
'filter_index'=>'main_table.my_data'
));
Data is displaying correctly from that column.
My problem is, I have stored values like 1,2,3 in 'my_data' column and now I want to display different values in Order grid depending on the values from 'my_data' column.
For example :
If 1 then 'A' should be displayed.
If 2 then 'B' should be displayed.
If 3 then 'C' should be displayed.
Best Answer
Magento Grid is a very handy tool for flexible data display. In Magento it is usually presented as a table data.There is a possibility to modify tables data if necessary. To do this, you need to add a column to Magento grid and overwrite the default renderer with a custom renderer in magento. your code will follow like
Make directory called Renderer inside directory where your Grid.php is located and make file Customvalue.php