gpt4 book ai didi

gridview - fatal error : Call to a member function setColumn() on a non-object in Magento

转载 作者:行者123 更新时间:2023-12-04 23:56:15 26 4
gpt4 key购买 nike

fatal error :在线调用 D:\Program Files\wamp\www\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid\Column.php 中非对象的成员函数 setColumn() 291

在管理网格部分,我使用了此列详细信息

protected function _prepareColumns()
{
$this->addColumn('giftcard_id',
array(
'header' => 'ID',
'align' => 'right',
'width' => '50px',
'index' => 'giftcard_id',
));

$this->addColumn('giftcard_id',
array(
'header' => 'Detail',
'align' => 'center',
'width' => '150px',
'renderer' => 'giftcard/adminhtml_giftcard_idrenderer',
'index' => 'giftcard_id',
));



$this->addColumn('created_time', array(
'header' => 'Creation Time',
'align' => 'left',
'width' => '120px',
'type' => 'date',
'default' => '--',
'index' => 'created_time',
));

$this->addColumn('update_time', array(
'header' => 'Update Time',
'align' => 'left',
'width' => '120px',
'type' => 'date',
'default' => '--',
'index' => 'update_time',
));


$this->addColumn('status', array(

'header' => 'Status',
'align' => 'left',
'width' => '80px',
'index' => 'status',
'type' => 'options',
'options' => array(
1 => 'Active',
0 => 'Inactive',
),
));
$this->addColumn('action',
array(
'header' => Mage::helper('giftcard')->__('Action'),
'width' => '50px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('giftcard')->__('Delete'),
'url' => array('base'=>'*/*/delete'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'is_system' => true,
));

return parent::_prepareColumns();
}

在giftcard/adminhtml_giftcard_idrenderer 中,我使用了以下代码
class Troy_Giftcard_Block_Adminhtml_Giftcard_Idrenderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
$value = $row->getData($this->getColumn()->getIndex());
$html = 'testing-'.$value .'-testing';
return $html;

}
}

当我使用
$this->addColumn('giftcard_id', 
array(
'header' => 'Detail',
'align' => 'center',
'width' => '150px',
'renderer' => 'giftcard/adminhtml_giftcard_idrenderer',
'index' => 'giftcard_id',
));

任何人都可以帮助我如何解决它

提前致谢

最佳答案

可能是 renderer class未找到。
尝试

'renderer' => 'troy_giftcard/adminhtml_giftcard_idrenderer',

关于gridview - fatal error : Call to a member function setColumn() on a non-object in Magento,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15918886/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com