Pagination urls above the table or scroll up after change page
Hello,
After I click at the next page on pagination, and the page is loaded it is not scrolling up to the first result of the table.
Is it possible to achieve this?
Also is it possible to have the paginated links at the top of the table, and not only at the bottom?
Thank you!
Solution:Jump to solution
Add this to a service provider or extract the js to your own script if you’re using a custom js file in filament.
```php
Filament::registerRenderHook(
'scripts.end',...
14 Replies
I don't think pagination at the top is possible out of the box unfortunately
Solution
Add this to a service provider or extract the js to your own script if you’re using a custom js file in filament.
I like that this is self-contained
And it’s not a lot of js so I’m comfortable doing it inline.
I have a minor alternative
Share it. 🙂
1 sec, I'll piggy back on your answer 😂
I agree that small inline scripts like this are totally fine, beats having a tiny external .js file
But I have the default filament setup!
The same problem exists also @ demo of filament. If I display 25 orders per page and move to the next page, it doesn't scroll up
https://demo.filamentphp.com/shop/orders?page=2
Then demo doesn’t use it. That’s why you have to add it. Scrolling on pagination clicks is not built in to filament or even livewire for that matter.
You can add it to any service provider.
This is good too, less global, but would work if you only wanted it on specific list pages.
Thank you both. One last question. Where to find the service provider? I mean, I have to put the Filament::registerRenderHook ..., Where?
app/Providers. It’s standard laravel. https://laravel.com/docs/10.x/providers#main-content
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Thank you very much! My mind thought it was a filament part, and I searched at documentation with no results!!
Yea. Filament is still just laravel so anything you can do in laravel you can do in filament.
I will usually make a FilamentServiceProvider though and do filament related stuff in there. With v3 it won’t be needed with the Panels package though.
Thank you both @awcodes @pboivin it worked 🙏