我有一个问题。如何仅将网格中选定的行导出为CSV或Excel文件?
public function exportCsvAction()
{
$fileName = 'Summary_employe_export.csv';
$content = $this->getLayout()->createBlock('monogo_harvest/adminhtml_summaryEmployee_edit_dayHarvest')->getCsv();
$this->_prepareDownloadResponse($fileName, $content);
}
public function exportExcelAction()
{
$fileName = 'Summary_Employe_export.xls';
$content = $this->getLayout()->createBlock('monogo_harvest/adminhtml_summaryEmployee_edit_dayHarvest')->getExcelFile();
$this->_prepareDownloadResponse($fileName, $content);
}
//Grid
$this->addExportType('*/*/exportCsv',
Mage::helper('monogo_workmanagement')->__('CSV'));
$this->addExportType('*/*/exportExcel',
Mage::helper('monogo_workmanagement')->__('Excel'));
答案 0 :(得分:0)
创建一个函数getCsv(),如bellow
do.call(cbind, result)