Skip to content

Commit 3da2c22

Browse files
authored
Merge pull request MedicOneSystems#353 from chrisjimallen/export-highlight-fix
Move highlight call before export callback calls.
2 parents a69fa6e + 19abc35 commit 3da2c22

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Http/Livewire/LivewireDatatable.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,9 @@ public function mapCallbacks($paginatedCollection, $export = false)
15481548
{
15491549
$paginatedCollection->collect()->map(function ($row, $i) use ($export) {
15501550
foreach ($row as $name => $value) {
1551+
if ($this->search && ! config('livewire-datatables.suppress_search_highlights') && $this->searchableColumns()->firstWhere('name', $name)) {
1552+
$row->$name = $this->highlight($row->$name, $this->search);
1553+
}
15511554
if ($export && isset($this->export_callbacks[$name])) {
15521555
$values = Str::contains($value, static::SEPARATOR) ? explode(static::SEPARATOR, $value) : [$value, $row];
15531556
$row->$name = $this->export_callbacks[$name](...$values);
@@ -1567,10 +1570,6 @@ public function mapCallbacks($paginatedCollection, $export = false)
15671570
} elseif (isset($this->callbacks[$name]) && is_callable($this->callbacks[$name])) {
15681571
$row->$name = $this->callbacks[$name]($value, $row);
15691572
}
1570-
1571-
if ($this->search && ! config('livewire-datatables.suppress_search_highlights') && $this->searchableColumns()->firstWhere('name', $name)) {
1572-
$row->$name = $this->highlight($row->$name, $this->search);
1573-
}
15741573
}
15751574

15761575
return $row;

0 commit comments

Comments
 (0)