Introducing Laravel Quizzes! Play now

Laravel Livewire Tables Documentation

This is the documentation for v2. 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.

public function configure(): void
{
    $this->setSecondaryHeaderStatus(true);
    $this->setSecondaryHeaderStatus(false);
}

setSecondaryHeaderEnabled

Enable the secondary header on the component.

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

setSecondaryHeaderDisabled

Disable the secondary header on the component.

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

setSecondaryHeaderTrAttributes

Set any attributes on the secondary header row element.

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

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

public function configure(): void
{
    $this->setSecondaryHeaderTrAttributes(function($rows) {
        return [
            'default' => true,
            'class' => 'bg-gray-100'
        ];
    });
}

setSecondaryHeaderTdAttributes

Set any attributes on the secondary header row cells.

public function configure(): void
{
    $this->setSecondaryHeaderTdAttributes(function(Column $column, $rows) {
        if ($column->isField('id')) {
            return ['class' => 'text-red-500'];
        }
    });
}

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

public function configure(): void
{
    $this->setSecondaryHeaderTdAttributes(function(Column $column, $rows) {
        if ($column->isField('id')) {
            return [
                'default' => true,
                'class' => 'text-red-500'
            ];
        }
    });
}

See also secondary header column configuration.