This code is add button export to csv in form same as grid page.
public function getElementHtml()
{
$buttonBlock = $this->getForm()->getParent()->getLayout()->createBlock(‘adminhtml/widget_button’);
$params = array(
‘website’ => $buttonBlock->getRequest()->getParam(‘website’)
);
$data = array(
‘label’ => Mage::helper(‘adminhtml’)->__(‘Download sample CSV’),
‘onclick’ => ‘setLocation(”.Mage::helper(‘adminhtml’)->getUrl(“*/*/exportCsv”, $params) . ‘conditionName/’ +’/tablerates.csv’ )’,
‘class’ => ”,
);
$html = $buttonBlock->setData($data)->toHtml();
return $html;
}
Enjoy.. 😀
(Visited 94 times, 1 visits today)