F
Filament16mo ago
faroukb

How to toggle pagination ?

Hey everyone, is there anyway to add an action that toggles pagination ? thanks
16 Replies
Dennis Koch
Dennis Koch16mo ago
What do you mean? Toggle it on/off?
faroukb
faroukbOP16mo ago
Yes exactly A button that can enable/disable pagination within a table
Dennis Koch
Dennis Koch16mo ago
You could probably save it in a property on the Livewire component and then query that property in the method that controls pagination. Not 100% sure of all the steps though
faroukb
faroukbOP16mo ago
I am not sure that works, here is my code : Within the list records
faroukb
faroukbOP16mo ago
No description
faroukb
faroukbOP16mo ago
and within the resource
faroukb
faroukbOP16mo ago
No description
Dennis Koch
Dennis Koch16mo ago
Might need a refresh of the table afterwards
faroukb
faroukbOP16mo ago
How can you do that within the action function ? is there a specific function that we can call from the $this->getTable() or another way arround ?
Dennis Koch
Dennis Koch16mo ago
You need to emit an Event and use a LW Listener to run $refresh. Haven't touched LW3 yet.
josef
josef16mo ago
use $this->dispatch('refreshTable'); in the action, and add protected $listeners = ['refreshTable' => '$refresh'] in the livewire component / page
faroukb
faroukbOP16mo ago
In my case I am trying to refresh a class extending ListRecords but it still not working
faroukb
faroukbOP16mo ago
No description
Dennis Koch
Dennis Koch16mo ago
Hm I don’t know. Is the table rerendered? Is getIsPaginated() called?
faroukb
faroukbOP16mo ago
Yes here is my code
faroukb
faroukbOP16mo ago
Within the public static function table(Table $table): Table
No description
Want results from more Discord servers?
Add your server