mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Setting MIME type for TableListField export explicitly, as HTTP::get_mime_type() requires a path to an actual file, in this case we're exporting data directly to the browser.
This commit is contained in:
parent
2392f93ce1
commit
39bd89879e
@ -961,10 +961,10 @@ JS
|
|||||||
* @todo Make relation-syntax available (at the moment you'll have to use custom sql)
|
* @todo Make relation-syntax available (at the moment you'll have to use custom sql)
|
||||||
*/
|
*/
|
||||||
function export() {
|
function export() {
|
||||||
$now = Date("d-m-Y-H-i");
|
$now = date("d-m-Y-H-i");
|
||||||
$fileName = "export-$now.csv";
|
$fileName = "export-$now.csv";
|
||||||
|
|
||||||
// No pagination for export
|
// No pagination for export
|
||||||
$oldShowPagination = $this->showPagination;
|
$oldShowPagination = $this->showPagination;
|
||||||
$this->showPagination = false;
|
$this->showPagination = false;
|
||||||
|
|
||||||
@ -973,8 +973,8 @@ JS
|
|||||||
$this->showPagination = $oldShowPagination;
|
$this->showPagination = $oldShowPagination;
|
||||||
|
|
||||||
if($fileData = $this->generateExportFileData($numColumns, $numRows)){
|
if($fileData = $this->generateExportFileData($numColumns, $numRows)){
|
||||||
return SS_HTTPRequest::send_file($fileData, $fileName);
|
return SS_HTTPRequest::send_file($fileData, $fileName, 'text/csv');
|
||||||
}else{
|
} else {
|
||||||
user_error("No records found", E_USER_ERROR);
|
user_error("No records found", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user