Table filters result
Hello everyone, Please how to use the result of table filters in my custom action?
Solution:Jump to solution
I'm not sure what you're doing but it's worth checking out https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export too
15 Replies
You're gonna need to give us some more info! It sounds like you just need a bulk action. I think you can also get the current table entries in a table header action too
I use header action
->headerActions([
Action::make('exportPdf')
->label('Exporter PDF')
->icon('heroicon-o-document-arrow-down')
->action(function ($livewire) {
return self::generatePdf($records, $livewire); }) ]) here is a piece of my code
return self::generatePdf($records, $livewire); }) ]) here is a piece of my code
try:
in your action
i got this error: Using $this when not in object context
Is that just in your LSP?
Oh wait....where is your table? Is it a
ListResource
or custom?yes in ListResource
what is LSP sorry I'm a novice
Hmm.
Where do you see that error?
In your IDE, or browser?
on browser
Oh, in that case you'll have to wait for someone far compotent than I 😅
I'd recommend a bulk action, I think it'll make for better UX too
Thanks for the help, but do you have a method with bluk action?
THANKS
Solution
I'm not sure what you're doing but it's worth checking out https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export too
oh, "PDF" the clue was right there in your action title. Not sure it'll support that, probably just csv/xls
(I'm also fairly new to filament)
looks like this supports:
->action(function($records) {})
which is exactly what you need, but would require the user to hit the "Select All" button once filtered. This would however (for better UX) let them additionally filter it by unticking/ticking the ones they need if the filter isn't enough for their purpose.ok thank you very much I will try that