Fast Pagination

@Dan Harrin I implemented the trick for fast pagination you outlined (https://filamentphp.com/community/danharrin-fast-table-pagination) but there is one issue. When selecting All records, it returns an error for trying to multiply string * int. I changed the function to:
protected function paginateTableQuery(Builder $query): Paginator
{
return $query->fastPaginate(($this->getTableRecordsPerPage() == 'all') ? 9999 : $this->getTableRecordsPerPage());
}
protected function paginateTableQuery(Builder $query): Paginator
{
return $query->fastPaginate(($this->getTableRecordsPerPage() == 'all') ? 9999 : $this->getTableRecordsPerPage());
}
and that avoids the error. I'm not sure if there is a better way around this. I didn't see a way to comment on the community post so I'm doing it here. Just wanted you to know. Filament is amazing - thank you!
Filament
How to improve table pagination performance by Dan Harrin - Filament
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
2 Replies
Dan Harrin
Dan Harrin13mo ago
you can actually submit a PR to the article on the filamentphp.com repo if you want! content/articles i'd say a better solution is ? $query->count() :
bwurtz999
bwurtz999OP13mo ago
Didn't realize I could do that. Yes, I will and yes, this is definitely the better solution. thanks!
Want results from more Discord servers?
Add your server