Skip to content

Commit f352dd6

Browse files
authored
Update CollectionDataTable.php
This change fix problem with non-existing variables/attributes during sorting by Collection engine. There is no problem with displaying undefined values thanks this: `->columnDefs([['defaultContent' => '-', 'targets' => '_all']])` But when we try sort column we will get an error: `Undefined index: resourcename.non_existing_attribute in C:\laragon\www\ptu\vendor\yajra\laravel-datatables-oracle\src\CollectionDataTable.php:298`
1 parent 2d15fb2 commit f352dd6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CollectionDataTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ protected function getSorter(array $criteria)
295295
$second = $b;
296296
}
297297
if ($this->config->isCaseInsensitive()) {
298-
$cmp = strnatcasecmp($first[$column], $second[$column]);
298+
$cmp = strnatcasecmp($first[$column] ?? null, $second[$column] ?? null);
299299
} else {
300-
$cmp = strnatcmp($first[$column], $second[$column]);
300+
$cmp = strnatcmp($first[$column] ?? null, $second[$column] ?? null);
301301
}
302302
if ($cmp != 0) {
303303
return $cmp;

0 commit comments

Comments
 (0)