Jon*_*Day 10
将此代码添加到Grid.php:
$this->addColumn('action',
array(
'header' => Mage::helper('yourmodulename')->__('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('yourmodulename')->__('Edit'),
'url' => array('base'=> '*/*/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));
Run Code Online (Sandbox Code Playgroud)
这将构建一个"编辑"URL,其中所选行的Id作为URL的一部分.它看起来像是getter返回的<frontname>/<controllername>/edit/id/<value>地方. valuegetId()
getter字段将执行任何标准的Magento魔术getter,即任何属性都是gettable.所以,你可以有getName或者getProductUrl或者getIsLeftHanded,如果你想和你的控制器可以解析的属性.
然后,控制器可以使用检索传递的值 Mage::app()->getRequest()->getParam('attributename');
在文档/教程方面,请阅读@AlanStorm网站上的这篇文章,因为它可能有所帮助.
HTH,
JD
| 归档时间: |
|
| 查看次数: |
7577 次 |
| 最近记录: |