仅导出到magento面板管理员中选定的行

时间:2017-09-12 11:46:02

标签: php excel magento export

我有一个问题。如何仅将网格中选定的行导出为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'));

enter image description here

1 个答案:

答案 0 :(得分:0)

创建一个函数getCsv(),如bellow

do.call(cbind, result)