Magento admin Grid columns 取到的值二次处理,譬如取到的category_id 得到名字

来源:互联网 发布:打脸 知乎 编辑:程序博客网 时间:2024/05/16 09:24

参考网址:http://www.magentocommerce.com/boards/viewthread/192232/#t239222

Do next:

1. Add column in your Grid.php file or rewrited file in next way

$this->addColumn('mycolumn', array(          'header'    => Mage::helper('core')->__('My Column'),          'align'     =>'left',          'index'     => 'created_at',          'type'    =>'action',          'renderer' => new Namespace_Module_Block_Adminhtml_Renderer_Date(),      ));


2. Create class Namespace_Module_Block_Adminhtml_Renderer_Date
here is the code

<?phpclass Namespace_Module_Block_Adminhtml_Renderer_Date extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{    public function render(Varien_Object $row)    {         $data = MyHelperClass::calculateSpecialDate($row->getData($this->getColumn()->getIndex()));          return $data;    }}?>


it seems to me - that’s all


0 0
原创粉丝点击