abisetra/livewire-datatables
A Laravel Livewire package for building interactive data tables with sorting, searching, and pagination in your Blade views. It aims to keep table setup simple and reactive without leaving the Livewire component model.
This package brings DataTables-style grids into Livewire. It has no meaningful release history since 1.0.0 in mid-2023 and almost no community footprint, so treat the README and source as the spec and verify against your stack before committing.
Minimal steps:
composer require abisetra/livewire-datatables
php artisan vendor:publish --provider="Abisetra\LivewireDatatables\LivewireDatatablesServiceProvider"
(Confirm the provider FQN in bootstrap/cache/packages.php after install.)tailwind.config.js content[], or safelist the classes it emits.First use case — a single table backed by an Eloquent query:
App\Http\Livewire\UsersTable).sortable, searchable, and any formatter or Blade view.<livewire:users-table />.Where to look first:
Builder (or query builder) and let the package apply search/sort/pagination. If you pre-->get(), you lose server-side processing and will load the whole table into memory.user.department.name) will N+1 unless you ->with([...]) in the base query. This is where most “the table is slow” complaints originate.wire:click="delete({{ $row->id }})", so the parent component owns the side effect.$this->dispatch('user-updated')) and have the table listen, or rely on the parent component re-rendering the table.wire:model.debounce.400ms binding on the search input. Avoid server round-trips on every keystroke.$queryString on the component so URLs are shareable and browser back works — a common expectation users bring from DataTables.Typical component skeleton:
// app/Http/Livewire/UsersTable.php
class UsersTable extends Component
{
use WithPagination;
protected $queryString = ['search' => ['except' => ''], 'sort', 'direction'];
public string $search = '';
public string $sort = 'created_at';
public string $direction = 'desc';
public function render()
{
return view('livewire.users-table');
}
}
Keep the query and column definitions in the component; keep presentation in a Blade file. That separation makes the table testable with Livewire::test(), where you can assert rendered rows, sorting behavior, and search filtering.
composer.json ("abisetra/livewire-datatables": "1.0.0") rather than ^1.0, and be ready to fork. Check the repository for open issues and the last commit date before adopting.dispatch, and pagination traits. Verify which v2/v3 the package targets; the 1.0.0 “Fixed Laravel compatability” note refers to Laravel, not Livewire. Mismatches typically show as silent non-updating tables or pagination errors."bg-{$color}-500") won’t appear in your compiled CSS. Either add the package’s vendor views to tailwind.config.js content or use fixed class maps. Symptom: table renders but badges/buttons are unstyled.@livewireScripts, Alpine ships with it; with Livewire 2 you may need @livewireScripts + alpinejs separately. Double-loading Alpine breaks dropdowns and column visibility toggles.->with() and consider adding explicit join-based sortable columns.LIKE '%term%' search on large tables with no index will time out. For real workloads, limit searchable columns or push to a dedicated search index.search or sort changes, call $this->resetPage(). Otherwise users see “empty page 3” after narrowing results — a very common report.vendor:publish --force will silently overwrite your customizations; diff before forcing.php artisan config:clear
php artisan view:clear
composer dump-autoload
Blade view caching is specifically relevant because the package ships views; stale compiled views after a publish are a classic “my change didn’t take” cause.$this->dispatch() events and Laravel Telescope’s Livewire panel to inspect queries and lifecycle runs per interaction. dd() inside the package’s render path kills the Livewire request and makes debugging harder than logging around your own base query.search, and changes sort, asserting the result set changes. Given the package’s age and low activity, this test is your regression guard against a future dependency bump silently breaking behavior.How can I help you explore Laravel packages today?