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!
Solution:
This is now fixed. In my case, I had made a mistake extending the TableWidget class. Once fixed, I was able to dispatch an event from the header filter action and listen to that elsewhere in the codebase. Once triggered, the listener can correctly call resetPage on the table widget.
Jump to solution
2 Replies
Solution
Stewart
Stewart2mo ago
This is now fixed. In my case, I had made a mistake extending the TableWidget class. Once fixed, I was able to dispatch an event from the header filter action and listen to that elsewhere in the codebase. Once triggered, the listener can correctly call resetPage on the table widget.
Ontamine&Vue
Ontamine&Vue3w ago
hi can you give more details? thanks
Want results from more Discord servers?
Add your server