Skip to content

Commit 45c7faf

Browse files
committed
Use unmodified row values when using a custom Export class.
1 parent b1311d0 commit 45c7faf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Services/DataTable.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,17 @@ public function excel()
405405
*/
406406
protected function buildExcelFile()
407407
{
408-
$dataForExport = collect($this->getDataForExport());
408+
if ($this->exportClass <> DataTablesExportHandler::class) {
409+
$collection = collect($this->getAjaxResponseData());
410+
} else {
411+
$collection = collect($this->getDataForExport());
412+
}
413+
414+
if (method_exists($collection, 'lazy')) {
415+
$collection->lazy();
416+
}
409417

410-
return new $this->exportClass($dataForExport);
418+
return new $this->exportClass($collection);
411419
}
412420

413421
/**

0 commit comments

Comments
 (0)