作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试将 AdminHtml 网格导出到 CSV。我找到了两种方法 getCsv() 和 getCsvFile() 用于将结果网格导出到 CSV 文件中。谁能告诉我这两个函数有什么区别?
方法-1
$fileName = "filename.csv";
$content = $this->getLayout()->createBlock('custom_modelue/adminhtml_report_grid')
->getCsv();
$this->_prepareDownloadResponse($fileName, $content);
方法-2
$fileName = "filename.csv";
$content = $this->getLayout()->createBlock('custom_modelue/adminhtml_report_grid')
->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);
当我使用方法 -1 时,过滤器不会应用于导出 CSV 结果。但在方法-2 中,过滤器应用于结果集。
最佳答案
getCsv() 和 getCsvFile() 的区别如下
get CsvFile() is
Retrieve a file container array by grid data as CSV
Return array with keys type and value
return array
在大多数情况下,getcsvFile 用于将网格包含导出到 magen 中的 csv 到系统
and getCsv() is
Retrieve Grid data as CSV
and return string
关于php - magento 中的 getcsv() 和 getcsvfile() 方法有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22452486/
我正在尝试将 AdminHtml 网格导出到 CSV。我找到了两种方法 getCsv() 和 getCsvFile() 用于将结果网格导出到 CSV 文件中。谁能告诉我这两个函数有什么区别? 方法-1
我是一名优秀的程序员,十分优秀!