© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
ariftography

How to get selected record from table in header action?

I want to make header action that can collect the selected record link in bulkaction and send all value to custom view in new tab, i have search in doc but i still not find any clue, this is my code


->headerActions([
Action::make('Label')
->url(fn () => route('label', ['selected_records' => ['33', '34']]))
->openUrlInNewTab(),
])

i want selected_records is array from selected record like bulkaction,

Thank you
Solution
I have found a simple solution for this problem, I use notification for opening bulk action in new tab, this is my code

BulkAction::make('Label Barcode')
                    ->label('Label Barcode')
                    ->action(function ($records) {

                        $selectedRecordIds = $records->pluck('id')->implode(',');

                        Notification::make()
                            ->title('Apakah Anda yakin akan mencetak label ini?')
                            ->success()
                            ->persistent()
                            ->actions([
                                Action::make('ya')
                                    ->button()
                                    ->url(route('label', $selectedRecordIds), shouldOpenInNewTab: true)
                                    ->close(),

                            ])
                            ->send();
                    }),
BulkAction::make('Label Barcode')
                    ->label('Label Barcode')
                    ->action(function ($records) {

                        $selectedRecordIds = $records->pluck('id')->implode(',');

                        Notification::make()
                            ->title('Apakah Anda yakin akan mencetak label ini?')
                            ->success()
                            ->persistent()
                            ->actions([
                                Action::make('ya')
                                    ->button()
                                    ->url(route('label', $selectedRecordIds), shouldOpenInNewTab: true)
                                    ->close(),

                            ])
                            ->send();
                    }),
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Get table data from header action.
FilamentFFilament / ❓┊help
3y ago
How to get all options from table filter in table header action?
FilamentFFilament / ❓┊help
17mo ago
How to get all table records in header action
FilamentFFilament / ❓┊help
2y ago
selected record in table not deselecting after action
FilamentFFilament / ❓┊help
3y ago