Open aswin-ghosh-chenattil opened 2 years ago
I have the same problem, the problem occurs when I query ID column in postgre DB:
Column::callback(["id", 'name'], function ($id, $name) {
return view('datatables::link', [
'href' => "/" . (string) $id,
'slot' => ucfirst($name)
]);
})
When I query id
column alone, it works.
Hi all, i found a solution for this, the problem is in postgresql, i search the function when create the CONCAT_WS and evaluate the id field to put a number , not a empty string in the coalesce function.
the file is: vendor/mediconesystems/livewire-datatables/src/Http/Livewire/LivewireDatatable.php
the line is: 351
return $selects->count() > 1
? new Expression("CONCAT_WS('" . static::SEPARATOR . "' ," .
collect($selects)->map(function ($select) {
$second = '';
if(strpos($select,'.id') != false){
$second = '0';
}
return 'COALESCE(' . $this->tablePrefix . $select . ', \''.$second.'\')';
})->join(', ') . ')')
: $selects->first();
this solution work but is very bad, i think the best solution is check de type of column.
I got the error - 'SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "" ' while adding callback with multiple values