F
Filament16mo ago
Medo

How to get Table filters values from tables ?

Hello every one , am using this plugin https://filamentphp.com/plugins/pxlrbt-excel and I want to export Data from table but it's export all and ignore applied filters ! so how can I get filters values from table to pass it to plugin query via ->modifyQueryUsing() ? Here's my export action in table header
->headerActions([
ExportAction::make()
->exports([
ExcelExport::make()->modifyQueryUsing(fn($query) => $query)
->withColumns([
Column::make('chartOfAccount.name'),
Column::make('chartOfAccount.chartOfAccountType.name'),
Column::make('chartOfAccount.subType.name'),
Column::make('journalEntry.date'),
Column::make('description'),
Column::make('debit'),
Column::make('credit'),
])
])
])
->headerActions([
ExportAction::make()
->exports([
ExcelExport::make()->modifyQueryUsing(fn($query) => $query)
->withColumns([
Column::make('chartOfAccount.name'),
Column::make('chartOfAccount.chartOfAccountType.name'),
Column::make('chartOfAccount.subType.name'),
Column::make('journalEntry.date'),
Column::make('description'),
Column::make('debit'),
Column::make('credit'),
])
])
])
2 Replies
jonbalagot
jonbalagot16mo ago
How about using the plugin's own filter method "except"? use pxlrbt\FilamentExcel\Actions\Tables\ExportAction; use pxlrbt\FilamentExcel\Exports\ExcelExport; ExportAction::make()->exports([ ExcelExport::make()->fromTable()->except([ 'created_at', 'updated_at', 'deleted_at', ]),
ExcelExport::make()->fromTable()->only([ 'id', 'name', 'title', ]), ])
Medo
MedoOP16mo ago
I don't have any problems with data selection , to explain more if I press export it's will export all table even if I have applied filters
Want results from more Discord servers?
Add your server