I am trying to export AdminHtml grids to CSV. I have two methods getCsv () and getCsvFile () to export the result grid to a CSV file. Could you tell me what is the difference between these two functions?
Method -1
$fileName = "filename.csv";
$content = $this->getLayout()->createBlock('custom_modelue/adminhtml_report_grid')
->getCsv();
$this->_prepareDownloadResponse($fileName, $content);
Method -2
$fileName = "filename.csv";
$content = $this->getLayout()->createBlock('custom_modelue/adminhtml_report_grid')
->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);
When I use the -1 method, filters are not applied to export CSV results. But in method -2, Filters are applied to the result set.
source
share