I want to get primary key of a table in grid.php in my module.
$string_clik="'".str_replace("index.php/",'',Mage::getUrl()).'wedding_planner_invoice.php?&w_id='. $howToGetID."'";
How to get Id in grid?
protected function _prepareColumns()
{
$this->addColumn("wedding_planner_id", array(
"header" => Mage::helper("planner")->__("ID"),
"align" =>"right",
"width" => "50px",
"type" => "number",
"index" => "wedding_planner_id",
));
$this->addColumn("customer_name", array(
"header" => Mage::helper("planner")->__("Name"),
"index" => "customer_name",
));
$this->addColumn("customer_email", array(
"header" => Mage::helper("planner")->__("Email Address"),
"index" => "customer_email",
));
$this->addColumn('planner_date', array(
'header' => Mage::helper('planner')->__('Order Date'),
'index' => 'planner_date',
'type' => 'datetime',
));
$string_clik="'".str_replace("index.php/",'',Mage::getUrl()).'wedding_planner_invoice.php?&w_id='. $this->wedding_planner_id."'";
$this->addColumn('action',
array(
'header' => Mage::helper('planner')->__('Action'),
'width' => '130px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('planner')->__('Generate Invoice'),
'url' => 'javascript:void(0)',
'field' => 'wedding_planner_id',
'onclick' => 'fnopenWindow('.$string_clik.')'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
return parent::_prepareColumns();
}