Laravel Livewire Tables Documentation

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

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


setBulkActions

Set the bulk actions array.

1public function configure(): void
2{
3 $this->setBulkActions([
4 'exportSelected' => 'Export',
5 ]);
6}

setBulkActionsStatus

Enabled by default, enable/disable bulk actions for the component.

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

setBulkActionsEnabled

Enable bulk actions on the component.

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

setBulkActionsDisabled

Disable bulk actions on the component.

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

setSelectAllStatus

Disabled by default, enable/disable pre-selection of all bulk action check boxes.

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

setSelectAllEnabled

Check all bulk action checkboxes.

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

setSelectAllDisabled

Deselect the select-all bulk actions checkbox.

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

setHideBulkActionsWhenEmptyStatus

Disabled by default, enable/disable hiding of bulk actions dropdown when empty.

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

setHideBulkActionsWhenEmptyEnabled

Hide bulk actions dropdown when empty.

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

setHideBulkActionsWhenEmptyDisabled

Show bulk actions dropdown when empty.

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

setBulkActionConfirms

When a bulk action is included in the array passed to setBulkActionConfirms, the default wire:confirm pop-up will appear prior to executing the bulk action. The default message is: "Are you sure?". This should only be used if you wish to use the default message.

1public function configure(): void
2{
3 $this->setBulkActionConfirms([
4 'delete',
5 'reset'
6 ]);
7}

setBulkActionDefaultConfirmationMessage

You may use this method to over-ride the default message. To override the confirmation message for an individual Bulk Action, see the below setBulkActionConfirmMessage and setBulkActionConfirmMessages. You may also use the language files to do this.

1public function configure(): void
2{
3 $this->setBulkActionDefaultConfirmationMessage('Are you certain?');
4}

setBulkActionConfirmMessage

You may use this method to specify a message other than the default message.

1public function configure(): void
2{
3 $this->setBulkActionConfirmMessage('delete', 'Do you want to delete these items?');
4}

setBulkActionConfirmMessages

You may pass an array to this method, to more effectively update the confirmation message for a larger quantity of bulk actions. This expects an array keyed by the bulk action name, with the value being the message that will be displayed to the user.

1public function configure(): void
2{
3 $this->setBulkActionConfirmMessages([
4 'delete' => 'Are you sure you want to delete these items?',
5 'purge' => 'Are you sure you want to purge these items?',
6 'reassign' => 'This will reassign selected items, are you sure?',
7 ]);
8}

setBulkActionsThAttributes

You may pass an array to this method, which allows you to pass Custom Attributes into the table header

1public function configure(): void
2{
3 $this->setBulkActionsThAttributes([
4 'class' => 'bg-red-500',
5 'default' => false
6 ]);
7}

setBulkActionsThCheckboxAttributes

You may pass an array to this method, which allows you to pass Custom Attributes into the Select All/None checkbox in the Table Header

1public function configure(): void
2{
3 $this->setBulkActionsThCheckboxAttributes([
4 'class' => 'bg-blue-500',
5 'default' => false
6 ]);
7}

setBulkActionsTdAttributes

You may pass an array to this method, which allows you to pass Custom Attributes into the td containing the Bulk Actions Checkbox for the row

1public function configure(): void
2{
3 $this->setBulkActionsTdAttributes([
4 'class' => 'bg-green-500',
5 'default' => true
6 ]);
7}

setBulkActionsTdCheckboxAttributes

You may pass an array to this method, which allows you to pass Custom Attributes into the Bulk Actions Checkbox for the row

1public function configure(): void
2{
3 $this->setBulkActionsTdCheckboxAttributes([
4 'class' => 'bg-green-500',
5 'default' => true
6 ]);
7}