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

参考网址: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

<?php

class 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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值