Open
Description
due to bugs
yajra/laravel-datatables#2324
yajra/laravel-datatables-html#123
due to code in
HasColumns.php
...
foreach ($columns as $key => $value) {
if (!is_a($value, Column::class)) {
if (is_array($value)) {
$attributes = array_merge(
[
'name' => $value['name'] ?? $value['data'] ?? $key,
'data' => $value['data'] ?? $key,
],
$this->setTitle($key, $value)
);
}
...
the default template doesn't work
protected function getColumns()
{
return [
'jobState.name'
];
}
the working solution is to change the returned array and the working function looks like
protected function getColumns()
{
return [
'jobState.name' => ['data' => 'job_state.name', 'name' => 'jobState.name'],
];
}
so the key is used for the title due to this line
$this->setTitle($key, $value)