How to Implement Pagination in ViewRecord Page with Custom View?
Hello, I'm trying to add pagination to a custom view in Filament. Here's my current setup:
1. File Location:
- Resource: app/Filament/Resources/TrabajoResource/Pages/ViewTrabajo.php
- Custom View: resources/views/filament/resources/trabajo/view.blade.php
2. Current Code:
3. View Implementation:
Issues I'm Facing:
1. First Attempt (Standard Pagination):
- Using
{{ $evidencias->links() }}
works functionally
- Issues:
- Design doesn't match Filament's style
- Full page refreshes cause scroll jumps
2. Second Attempt (Filament Pagination Component):
- Using <x-filament::pagination :paginator="$evidencias" extreme-links />
:
- Pros: Perfect design match with Filament
- Errors: Throws Livewire errors when clicking:
How can I implement pagination in a ViewRecord page that:
- Uses Filament's styled pagination component
- Properly handles page navigation without Livewire errors
- Maintains smooth UX without full page refreshes?
I've checked the Filament Pagination docs but they seem focused on component.
Thank you in advance for your help1 Reply
I think those docs are a good start. Additionally check the source code of the component. It seems to require some methods on the component. The ListPage implements them via the
CanPaginate
trait. You can look there too, but need to implement them yourself, because those are related to a table.