F
Filament8mo ago
cj

Is it possible to add an ImportAction to a form tab?

I would like to add a button for an ImportAction to a tab on a resource's form.
I understand that ImportAction isn't an acceptable type for this use, but I'm also struggling to find a workaround. Any ideas?
Filament\Forms\Components\Actions::Filament\Forms\Components\{closure}(): Argument #1 ($action) must be of type Filament\Forms\Components\Actions\Action, Filament\Actions\ImportAction given
Filament\Forms\Components\Actions::Filament\Forms\Components\{closure}(): Argument #1 ($action) must be of type Filament\Forms\Components\Actions\Action, Filament\Actions\ImportAction given
Tabs\Tab::make('Tab 1')
Actions::make([
// This action works fine
Actions\Action::make('View Some Stuff')
->url(function ($record): string {
return 'https://yahoo.com';
})
->openUrlInNewTab(),

// This throws an exception because ImportAction isn't an acceptable type
ImportAction::make('importStuff')
->label('Import Stuff')
->importer(StuffImporter::class)
->options(['thing_id' => 1]),
Tabs\Tab::make('Tab 1')
Actions::make([
// This action works fine
Actions\Action::make('View Some Stuff')
->url(function ($record): string {
return 'https://yahoo.com';
})
->openUrlInNewTab(),

// This throws an exception because ImportAction isn't an acceptable type
ImportAction::make('importStuff')
->label('Import Stuff')
->importer(StuffImporter::class)
->options(['thing_id' => 1]),
2 Replies
toeknee
toeknee8mo ago
I've not tried it... but worse case you should be able to create a livewire component with it on, and render that in a view field?
Bimby13
Bimby134mo ago
Hi! Did you already solve this? I am seeking also for this.
Want results from more Discord servers?
Add your server