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 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

Events

Listened For

These are the available events on the datatable component that you can fire from your application, or client-side

refreshDatatable

1$this->dispatch('refreshDatatable');

Calls $refresh on the component. Good for updating from external sources or as an alternative to polling.

setSort

You can have the table sort a specific column:

1$this->dispatch('setSort', 'name', 'asc');

clearSorts

You can clear all the applied sorts:

1$this->dispatch('clearSorts');

setFilter

You can have the table run a specific filter:

1$this->dispatch('setFilter', 'status', '1');

clearFilters

You can have the table clear all filters:

1$this->dispatch('clearFilters');

Dispatched

There are several events, all in the Rappasoft\LaravelLivewireTables\Events namespace

Event Name Event Purpose Data Passed
ColumnsSelected Applied whenever a Column is selected/deselected from view The Table Name ($tableName), Selected Columns ($value), Logged In User ($user)
FilterApplied Applied when a Filter is applied (not when removed) The Table Name ($tableName), Filter Key ($key), Filter Value ($value), Logged In User ($user)
SearchApplied Applied when a Search is applied (not when removed) The Table Name ($tableName), Search Term ($value), Logged In User ($user)

Passing the user with an event is optional and can be disabled in the config.

By default, the Tables will dispatch an event when the Selected Columns is changed, you may customise this behaviour:

enableAllEvents

This enables all Dispatched Events. This should be used with caution, as more events will be introduced in the future.

1public function configure(): void
2{
3 $this->enableAllEvents();
4}

disableAllEvents

This disables all Dispatched Events.

1public function configure(): void
2{
3 $this->disableAllEvents();
4}

enableColumnSelectEvent

Enables the Column Select Event, has no impact on other events

1public function configure(): void
2{
3 $this->enableColumnSelectEvent();
4}

disableColumnSelectEvent

Disables the Column Select Event, has no impact on other events

1public function configure(): void
2{
3 $this->disableColumnSelectEvent();
4}

enableSearchAppliedEvent

Enables the Search Applied Event, has no impact on other events

1public function configure(): void
2{
3 $this->enableSearchAppliedEvent();
4}

disableSearchAppliedEvent

Disables the Search Applied Event, has no impact on other events

1public function configure(): void
2{
3 $this->disableSearchAppliedEvent();
4}

enableFilterAppliedEvent

Enables the Filter Applied Event, has no impact on other events

1public function configure(): void
2{
3 $this->enableFilterAppliedEvent();
4}

disableFilterAppliedEvent

Disables the Filter Applied Event, has no impact on other events

1public function configure(): void
2{
3 $this->disableFilterAppliedEvent();
4}