How to toggle pagination ?
Hey everyone, is there anyway to add an action that toggles pagination ? thanks
16 Replies
What do you mean? Toggle it on/off?
Yes exactly
A button that can enable/disable pagination within a table
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
I am not sure that works, here is my code :
Within the list records
and within the resource
Might need a refresh of the table afterwards
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 ?You need to emit an Event and use a LW Listener to run
$refresh
. Haven't touched LW3 yet.use
$this->dispatch('refreshTable');
in the action, and add protected $listeners = ['refreshTable' => '$refresh']
in the livewire component / pageIn my case I am trying to refresh a class extending
ListRecords
but it still not workingHm I don’t know. Is the table rerendered? Is
getIsPaginated()
called?Yes here is my code
Within the
public static function table(Table $table): Table