#Get table records

12 messages · Page 1 of 1 (latest)

subtle mirage
#

i want to get those records show in the filament table even apply filters in closure functions

nimble timber
#

Try providing some more info

subtle mirage
#

In a Filament table resource, I have created an action button on the list page. I want to export the data displayed in the table, and for that, I need to get the table data in a custom export class. The challenge is to ensure that when filters are applied to the table (e.g., if 5 users are displayed initially and after applying filters, only 2 users remain), the custom export should include only the 2 users shown after filtering. This means that the export should include all the records currently displayed in the table, whether filters are applied or not.

nimble timber
#

You should be able to access those through fn ($livewire) => $livewire->getFilteredTableQuery()->get()

subtle mirage
#

its working but if i same thing in UserResources Main File. How i can perform this task

#

getFilteredTableQuery()

i use this in UserResource main file and it not working

($livewire) => $livewire->getFilteredTableQuery()->get()

#

Tables\Actions\Action::make('exports')
->label('Export')
->icon('heroicon-s-download')
->color('success')
->action(function ($livewire) : void{
dd($livewire->getFilteredTableQuery()->get());
}),

nimble timber
subtle mirage
#

yes i use in table header action


Tables\Actions\Action::make('exports')
->label('Export')
->icon('heroicon-s-download')
->color('success')
->action(function($livewire)
{
$livewire
->getFilteredTableQuery()
->get();
})
nimble timber
#

Get table records

subtle mirage
#

no empty collection it return the error getFilteredTableQuery() method does exist in userresources/pages/ListUser.php