Get all selected records inside a custom page

I would like use bulk actions outside the 3dots dropdown, this is possible ?
4 Replies
DrByte
DrByte13mo ago
Can you explain more about what you mean by "use" and "outside"? Bulk Actions are mostly geared around a list of records Filament is displaying in one of its Tables. By "use" do you mean "move them elsewhere on the page"? Or do you mean "put them on a different page, using them for something else"? Images and/or code samples might help reduce ambiguity.
Fábio Roque
Fábio RoqueOP13mo ago
the use case is, I have an export action that is possible export the data from selected records, it works as expected with BulkAction but the stakeholder doesn't like the default behavior of filament, so He asked me to have this export button outside of the table... I would like to have this action in headerActions
DrByte
DrByte13mo ago
Ok. I see. That context helps the question make more sense. I haven't tried doing as you mention, but I know that BulkActions rely on being aware of record entries in the table. But they're also based on a core BulkAction component which has awareness of that. So, I would expect that it can probably be done by declaring your Table BulkAction in the HeaderActions section instead. If there are problems with it, it might simply be in linking it to the right Table. That's the long way of saying: give it a try, and if there's trouble, post your code and that'll help garner responses that offer specifics about how to correct it.
Fábio Roque
Fábio RoqueOP13mo ago
I can't use a bulkAction inside the getTableHeaderActions()
protected function getTableHeaderActions(): array
{
return [
Action::make('export-users')
->action(function (array $data, $livewire) {
// how to get all selected records here?

// I can get all records, all filtered records, but selected?
dd($livewire->getFilteredTableQuery()->get());
})
];
}
protected function getTableHeaderActions(): array
{
return [
Action::make('export-users')
->action(function (array $data, $livewire) {
// how to get all selected records here?

// I can get all records, all filtered records, but selected?
dd($livewire->getFilteredTableQuery()->get());
})
];
}
Want results from more Discord servers?
Add your server