When exporting in Excel, the table comes blank Can you help?

"When I attempt to download an Excel file using this method, the downloaded file is empty, and the data from the selected portion does not appear in the Excel table."
ExcelExport::make('form')->fromForm(),
ExcelExport::make('form')->fromForm(),
When I use it as shown above, it downloads the data for the entire table instead of the intended selection I simply want the content of the data to be downloaded when I press the export button next to it. https://filamentphp.com/plugins/pxlrbt-excel#usage
->actions([
Tables\Actions\EditAction::make(),
ExportAction::make()->exports([
ExcelExport::make('table')
])
])

->actions([
Tables\Actions\EditAction::make(),
ExportAction::make()->exports([
ExcelExport::make('table')
])
])

Filament
Excel Export by Dennis Koch - Filament
Easy Excel exports for Filament Admin
No description
No description
22 Replies
toeknee
toeknee13mo ago
I beleive you are using a table action opposed to a header action. So therefore you need to select the records to export
Mehmet K.
Mehmet K.OP13mo ago
"I also tried this process by selecting it, but once again, the Excel table appears to be empty." ExportAction::make()->exports([ ExcelExport::make()->withWriterType(\Maatwebsite\Excel\Excel::XLSX), ])
No description
toeknee
toeknee13mo ago
Intresting, can you check which class you are extending for the export button? and is this V3 or V2
Mehmet K.
Mehmet K.OP13mo ago
V3
toeknee
toeknee13mo ago
@Dennis Koch thoughts? #pxlrbt-excel
Mehmet K.
Mehmet K.OP13mo ago
No description
Dennis Koch
Dennis Koch13mo ago
You didn't specify any columns that why it doesn't export any. Please check the docs. You can use ->fromTable(), ->formRecord(), ->withColumns(), ...
Mehmet K.
Mehmet K.OP13mo ago
Actually, the problem is that I have tried these of course, I select a single data to download, but it downloads all the records. for example
No description
No description
toeknee
toeknee13mo ago
That's because youn are then using the header action, opposed to a bulk action I suspect?
Mehmet K.
Mehmet K.OP13mo ago
The bulkActions part works correctly and gives the result I want, but the action part does not work the same way.
No description
toeknee
toeknee13mo ago
The action part is the table action, so it's designed to export the whole table.
Mehmet K.
Mehmet K.OP13mo ago
I don't think there's any way I can get this one.
toeknee
toeknee13mo ago
You want the Table Action Button to respect the same process as BulkAction, right?
Mehmet K.
Mehmet K.OP13mo ago
Yes
toeknee
toeknee13mo ago
You will need to review https://filamentphp.com/plugins/pxlrbt-excel#modify-the-query and look to include a where, the id's are in$this->table->selectedId's or similar.
Filament
Excel Export by Dennis Koch - Filament
Easy Excel exports for Filament Admin
Mehmet K.
Mehmet K.OP13mo ago
I am trying to access the clicked record but I have not been successful at this point
->modifyQueryUsing(fn (Payment $record) => $record->where('id',$record->id))
No description
toeknee
toeknee13mo ago
use $this->table ?
Mehmet K.
Mehmet K.OP13mo ago
Not working $this->table
toeknee
toeknee13mo ago
Then I am unsure,
Dennis Koch
Dennis Koch13mo ago
I don’t think you can access the Livewire component from that closure. I don’t understand why you are trying to replicate the same behavior as a BulkAction instead of using the bulk action
toeknee
toeknee13mo ago
I know why, it's to reduce a single click, which does make sense in a high use exporting scenario.
Dennis Koch
Dennis Koch13mo ago
You can have ungrouped BulkActions in v3
Want results from more Discord servers?
Add your server