I'm currently available for full time hire! Inquire Here

Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v2 but the latest version is v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Available Methods

These are the available configuration methods for the secondary header.


setSecondaryHeaderStatus

Enabled by default, enable/disable the secondary header for the component.

1public function configure(): void
2{
3 $this->setSecondaryHeaderStatus(true);
4 $this->setSecondaryHeaderStatus(false);
5}

setSecondaryHeaderEnabled

Enable the secondary header on the component.

1public function configure(): void
2{
3 // Shorthand for $this->setSecondaryHeaderStatus(true);
4 $this->setSecondaryHeaderEnabled();
5}

setSecondaryHeaderDisabled

Disable the secondary header on the component.

1public function configure(): void
2{
3 // Shorthand for $this->setSecondaryHeaderStatus(false);
4 $this->setSecondaryHeaderDisabled();
5}

setSecondaryHeaderTrAttributes

Set any attributes on the secondary header row element.

1public function configure(): void
2{
3 $this->setSecondaryHeaderTrAttributes(function($rows) {
4 return ['class' => 'bg-gray-100'];
5 });
6}

By default, this replaces the default classes on the tr element, if you would like to keep them, set the default flag to true.

1public function configure(): void
2{
3 $this->setSecondaryHeaderTrAttributes(function($rows) {
4 return [
5 'default' => true,
6 'class' => 'bg-gray-100'
7 ];
8 });
9}

setSecondaryHeaderTdAttributes

Set any attributes on the secondary header row cells.

1public function configure(): void
2{
3 $this->setSecondaryHeaderTdAttributes(function(Column $column, $rows) {
4 if ($column->isField('id')) {
5 return ['class' => 'text-red-500'];
6 }
7 });
8}

By default, this replaces the default classes on the td element, if you would like to keep them, set the default flag to true.

1public function configure(): void
2{
3 $this->setSecondaryHeaderTdAttributes(function(Column $column, $rows) {
4 if ($column->isField('id')) {
5 return [
6 'default' => true,
7 'class' => 'text-red-500'
8 ];
9 }
10 });
11}

See also secondary header column configuration.