0

Currently I have this php code:

    $this->addColumn('action_urls', array(
            'header' => $this->__('Update LP'),
            //'index' => 'action_url',
            'width'     => '100',
            'filter'    => false,
            'sortable'  => false,                
            'type'      => 'action',
            'actions'   => array(
                    array(
                        'caption'   => Mage::helper('viajemos_general')->__('Update LP'),
                        'field'     => 'action_url',
                        'onclick' => "showLandingPage('".$this->getUrl('admingeneral/adminhtml_LandingPagesUploader/createUpdateHotelProductLP/', array('id_viajemos' => $this->getId() ))."')" 
                    )
                ),                
        )
    );

I need to send in the row id in the 'onclick' from the grid, but with "$this->getId()" isn't possible.

1 Answers1

0

You cannot pass the id in onclick as in your example...you can only have it replaced in the url key as in this answer.
However for you there is a solution: Give up of column of type 'action' and create a custom renderer...you can find a plenty of examples on net...here is one of them. Your custom render should look something like

public function render(Varien_Object $row)
{
    return '<span onclick="showLandingPage(\'' . $this->getUrl('admingeneral/adminhtml_LandingPagesUploader/createUpdateHotelProductLP/', array('id_viajemos' => $row->getId())) . '\')">' . $this->__('Update LP') . '</span>';
}
Community
  • 1
  • 1