Add this code to your 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, ));
This will create an βEditβ URL with the ID of the selected row as part of the URL. It will look something like <frontname>/<controllername>/edit/id/<value> , where value returned by the getId() receiver.
The getter field will execute any of the standard Magento magic getters, i.e. any attribute is gettable. That way you can have getName or getProductUrl or getIsLeftHanded if you want, and your controller can parse the attribute.
Then the controller can get this passed value using Mage::app()->getRequest()->getParam('attributename');
For documentation / tutorials, read this article on @AlanStorm's website as this may help.
NTN
Jd
source share