Skip to content

Commit b9a36aa

Browse files
authored
Merge pull request #187 from ejgandelaberon/master
feat: fast excel export via Column's exportRender()
2 parents 8980642 + 8c519f4 commit b9a36aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: src/Services/DataTable.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,13 @@ public function fastExcelCallback(): Closure
678678
$this->exportColumns()
679679
->reject(fn (Column $column) => $column->exportable === false)
680680
->each(function (Column $column) use (&$mapped, $row) {
681-
$mapped[$column->title] = $row[$column->data];
681+
$callback = $column->exportRender ?? null;
682+
683+
if (is_callable($callback)) {
684+
$mapped[$column->title] = $callback($row, $row[$column->data]);
685+
} else {
686+
$mapped[$column->title] = $row[$column->data];
687+
}
682688
});
683689

684690
return $mapped;

0 commit comments

Comments
 (0)