Get table data from header action.
I have a custom table header action .How can I access the table data from the action() method of the table header action? Tried to access it from the $livewire property like so but can't really get it .
Solution:Jump to solution
this will get all from the fitlered table:
```php
Action::make('test')
->action(fn($data, $livewire) => dd($livewire->getFilteredTableQuery()->get())),...
15 Replies
Looking at how AlperenErsoy did it with filamentexport:
Thank you for the insight , though i get the error Method Filament\Tables\Actions\Action::fillDefaultData does not exist. .
updated
Meaning?
meaning I updated the existing code.
What's the method name in the updated code? Any idea please?
It'sthe code above, just copy it
I've just remove the fillDefaultData
Sorry but still experiencing the same error but this time with the getRecords() method as below
What about
$this->getTableRecords()
?
I'm not sure of the top of my head with V3 but these are along the lines that I would expect
Will give you the filtered/records displayed
Solution
this will get all from the fitlered table:
This one works .Thank you so much.
Just note, that will only get the pagnatied rows not ALL the rows.
Oh had forgotten that. And how do we get all of the rows.
I've litterally said it above .....
Here
oh my. Thank you.I really appreciate.