Hi all. I am making a simple package to create datatables for Livewire components, similar to Filament tables. It still in the initial development with just a few columns added but I'll appreciate any feedback and suggestions for the work done so far.
I would write my own tables. If you go through the learning curve and learn well you will never need anything like "datatables".
I can do inline edit, add on the fly, and reorder easily. But yes there is a learning curve.
If you do use datatables make sure to use server side pagination.
There was actually a user trying to load records in the millions then paginate, a big no no.
He was wondering why everything took so long..
@jlrdw I am paginating the query as suggested by you:
$table = new Table;
// Start with the base query defined in the component
$query = $this->table($table)->getQuery();
// Apply search filter if there's any input
if (! empty($this->search)) {
$query->where(function ($q) use ($table) {
foreach ($table->getColumns() as $column) {
if ($column->searchable) {
$q->orWhere($column->key, 'LIKE', "%{$this->search}%");
}
}
});
}
if (! empty($this->sortField)) {
$query->orderBy($this->sortField, $this->sortDir);
}
// Ensure the query is paginated before passing it to the table
$paginatedResults = $query->paginate($this->perPage);
and I'm trying to make things as simple as possible.
@jlrdw Yes, this is one of them but doesn't work well with Laravel 12 as far as I've tested. And the others are either not very popular i.e. you cannot be sure how and for how long they are supported or are very old.