laravel-livewire-tables
laravel-livewire-tables copied to clipboard
[Bug]: setThAttributes default Flag not working
What happened?
It seems the " 'default' => true" ist not working when applied in setThAttributes();
Expected behaviour: use default = true gives the same result when using default-colors = true and default-styling = true;
How to reproduce the bug
For this case we just take a look at the column "Action". Adding custom class
$this->setThAttributes(function(Column $column) {
$title = $column->getTitle();
switch ($title) {
case 'Actions':
return [
'class' => 'colum-action',
];
break;
}
return [];
});
results in different style on the Action colum
added default flag as described in https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/styling#content-keeping-default-colors-and-default-styling
$this->setThAttributes(function(Column $column) {
$title = $column->getTitle();
switch ($title) {
case 'Actions':
return [
'default' => true,
'class' => 'colum-action',
];
break;
}
return ['default' => true];
});
this change do nothing, column header looks same way as before:
default classes are still overridden
Now if i add only default-styling:
$this->setThAttributes(function(Column $column) {
$title = $column->getTitle();
switch ($title) {
case 'Actions':
return [
'default-styling' => true,
'class' => 'colum-action',
];
break;
}
return ['default-styling' => true];
});
this shows effect:
if i add default-colors:
$this->setThAttributes(function(Column $column) {
$title = $column->getTitle();
switch ($title) {
case 'Actions':
return [
'default-styling' => true,
'default-colors' => true,
'class' => 'colum-action',
];
break;
}
return ['default-styling' => true, 'default-colors' => true];
});
it also works:
The docs says #Keep Default Colors And Default Styles set default flag to true or set default-colors flag to true set default-styling flag to true
i can use default OR the other two, but as shown above the default flag does nothing.
Using 3.4.22 version, but it seems it is in since 3.4.21.
Package Version
3.4.22
PHP Version
8.2.x
Laravel Version
11.27.2
Alpine Version
No response
Theme
Tailwind 3.x
Notes
No response
Error Message
No response