How do I define the target for _addButton? Below is the code I am using. I read the Magento docs located here but they didn’t have this info: http://docs.magentocommerce.com/Mage_Adminhtml/Mage_Adminhtml_Block_Widget_Container.html#method_addButton
$this->_addButton('rebuild_files', array(
'label' => Mage::helper('core')->__('Rebuild Special Cache'),
'onclick' => 'setLocation(\'http://mysite.com/page/\')',
'class' => 'rebuild',
));
Setting a target is not possible because a container’s buttons are not inside a form, and it is the form’s target that makes a difference. Furthermore that button doesn’t trigger any form but uses javascript to direct the browser (hence the
setLocationbit). Magento admin has a convenience function for what you want calledpopWin, it is shorthand forWindow.openso the second parameter is the target window name.PS.
_addButtonis a protected method. It is better to use the publicaddButtonin case another developer should attempt to change it’s behaviour.