Stewart
Stewart
FFilament
Created by Stewart on 9/10/2024 in #❓┊help
Reset Table Widget Pagination
I have encountered an issue when filtering a custom dashboard page in my Filament panel. When I apply a filter I would like the pagination to return to the first page / be reset. I believe I have tried all of the options available to me but it appears that I am unable to access the correct pagination instance. A SiteLiaisonManagement class that extends the Filament Dashboard class is used to form the page. Within this class there is an getHeaderActions call which defines a custom ResetFilterAction action and a Filament FilterAction action. When either of these header actions are submitted, I would like the pagination on the table widget to reset to the first page. The table in question is included as a widget manually within the SiteLiaisonManagement class using the getWidgets method. I have tried using the Livewire resetPage and setPage(1) methods from the WithPagination trait without success. If I debug Livewire’s $paginators array it is empty when either the ResetFilterAction action or FilterAction action are first called. This is the same whether I use queryStringIdentifier method on the table instance or not. If I dump again after the action has taken place, I have been able to set (what appears to be) the correct paginator page number to 1 but neither the table widget or page URL updates. Another avenue I have explored is using an event that dispatches when the header action is completed but this has also been unsuccessful. Any help is certainly appreciated!
5 replies