2

I want to add popup link on Grid.php , i tried

      $this->addColumn('action', array(
            'header'    =>  Mage::helper('mymodule')->__('Action'),
            'width'     => '80',
            'type'      => 'action',
            'getter'    => 'getId',
            'actions'   => array(
                array(
                    'caption'   => Mage::helper('feedback')->__('Reply'),
                    'url'       => array('base'=> '*/*/edit'),
                    'field'     => 'id',
                    'onclick' =>"return popitup('".$this->getUrl('*/*/edit', array('id' => $this->getId()))."')"
                )
            ),
            'filter'    => false,
            'sortable'  => false,
            'index'     => 'stores',
            'is_system' => true,
    ));

I want both below link same

<a href="http://localhost/magento/index.php/feedback/adminhtml_mymodule/edit/id/4/key/220a1ff8d9526bd40f43e79502897d3f/" onclick="return popitup('http://localhost/magento/index.php/feedback/adminhtml_mymodule/edit/id/mymoduleGrid/key/220a1ff8d9526bd40f43e79502897d3f/')">Reply</a>

2 Answers 2

1

Try replacing:

'onclick' =>"return popitup('".$this->getUrl('*/*/edit', array('id' => $this->getId()))."')"

with

'target'    => '_blank'
3
  • thanks @Marius, but i want to show only pop up window, just i want row id of table , as i had fetched all data into Grid. I tried array('id' => $this->getId())) instead of function getRowUrl($row). Stil unable to get result. In future i want to change popbox to lightbox. Feb 17, 2014 at 10:58
  • Is there any way to fetch id of row at 'onclick' =>"return popitup('".$this->getUrl('*/*/edit', array('id' => $this->getId()))."')" this line. 'id' => $this->getId() just i want to change this line Feb 18, 2014 at 5:20
  • Why not implementing your own JS file with an onclick handler, then you have the full control over the event object Mar 19, 2014 at 12:01
1

Magento has an attribute for this already -> 'popup'.

Replace:

'onclick' =>"return popitup('".$this->getUrl('*/*/edit', array('id' => $this->getId()))."')"

With:

'popup' => true

For more information on this check out:

Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action

In the method _transformActionData() it says:

case 'popup':
     $action['onclick'] =
          'popWin(this.href,\'_blank\',\'width=800,height=700,resizable=1,scrollbars=1\');return false;';
                break;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.