© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago
Darpan

Scroll to top on pagination select after next page data is received

The following code works, but on the live server it scrolls to top way before loading next page data, is there any way to wait for next page data and then scroll?

Filament::registerRenderHook('scripts.end',
  fn(): string => new HtmlString('
    <script>
      document.addEventListener("click", function(e) {
        if (e?.target?.closest("nav")?.classList.contains("filament-tables-pagination")){
          window.scrollTo({top: 0, behavior: "smooth"});
        }
      });
    </script>
'),
            );
Filament::registerRenderHook('scripts.end',
  fn(): string => new HtmlString('
    <script>
      document.addEventListener("click", function(e) {
        if (e?.target?.closest("nav")?.classList.contains("filament-tables-pagination")){
          window.scrollTo({top: 0, behavior: "smooth"});
        }
      });
    </script>
'),
            );
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Menu scroll to top After click on item.
FilamentFFilament / ❓┊help
16mo ago
Scroll top after form submit
FilamentFFilament / ❓┊help
3y ago
Pagination urls above the table or scroll up after change page
FilamentFFilament / ❓┊help
3y ago
How to remove the pagination per page select
FilamentFFilament / ❓┊help
5mo ago