F
Filament3mo ago
nowak

How to fully disable export action modal?

I have this export header action on my table:
ExportAction::make()
->hidden(fn (Component $livewire) => $livewire->getTableRecords()->isNotEmpty() ? false : true)
->label('Export CSV')
->columnMapping(false)
->color('primary')
->icon('heroicon-o-arrow-up-tray')
->exporter(GroupOrderManagementExporter::class)
->formats([
ExportFormat::Csv,
]),
ExportAction::make()
->hidden(fn (Component $livewire) => $livewire->getTableRecords()->isNotEmpty() ? false : true)
->label('Export CSV')
->columnMapping(false)
->color('primary')
->icon('heroicon-o-arrow-up-tray')
->exporter(GroupOrderManagementExporter::class)
->formats([
ExportFormat::Csv,
]),
Where I have set columnMapping(false). But I still get the modal shown in the first screenshot. And when I add ->requiresConfirmation(false), I get the same confirmation modal, just slightly bigger, as shown in the second screenshot. How can we disable this modal entirely? I would like to just click the action, and start the export.
No description
No description
10 Replies
nowak
nowak3mo ago
Bump
LeandroFerreira
LeandroFerreira3mo ago
maybe this?
->mountUsing(fn ($livewire) => $livewire->callMountedTableAction())
->mountUsing(fn ($livewire) => $livewire->callMountedTableAction())
BloodDrunk
BloodDrunk2mo ago
bump, tried using leandro's solution, doesn't seem to do anything.
LeandroFerreira
LeandroFerreira2mo ago
could share your code?
nowak
nowak2mo ago
This almost works for me. The modal is no longer shown, and the action is triggered right away. The issue is that the darkened overlay from the modal is still present, and requires a click to be "removed". See my screen recording and code for reference:
ExportAction::make()
->hidden(fn (Component $livewire) => $livewire->getTableRecords()->isNotEmpty() ? false : true)
->label('Export CSV')
->columnMapping(false)
->color('primary')
->icon('heroicon-o-arrow-up-tray')
->mountUsing(fn ($livewire) => $livewire->callMountedTableAction())
->exporter(GroupOrderManagementExporter::class)
->formats([
ExportFormat::Csv,
]),
ExportAction::make()
->hidden(fn (Component $livewire) => $livewire->getTableRecords()->isNotEmpty() ? false : true)
->label('Export CSV')
->columnMapping(false)
->color('primary')
->icon('heroicon-o-arrow-up-tray')
->mountUsing(fn ($livewire) => $livewire->callMountedTableAction())
->exporter(GroupOrderManagementExporter::class)
->formats([
ExportFormat::Csv,
]),
Rome
Rome2mo ago
Hello. Did you find any solution?
nowak
nowak2mo ago
No, unfortunately not.
BloodDrunk
BloodDrunk2mo ago
I had to resort to making my own exporter controllers and services, and custom buttons, as I also wanted to avoid modals and have instant download without storing it on the filesystem. Maybe filament should allow instant downloads once the export is completed instead of having it stored
nowak
nowak2mo ago
I agree, or provide an option to do both. I like the idea of using the job queue, but once completed, an option to receive a direct download prompt would be very useful for cases where the job queue is never "needed". We will export a max of 50 rows and 8 cols of data, which is always processed instantly. @BloodDrunk Would you be willing to share your custom setup?
BloodDrunk
BloodDrunk2mo ago
Im not sure what you mean by "share", but I am indeed open to help you point in the right direction, what you need?