#how to get selected table record inside list page resource

4 messages · Page 1 of 1 (latest)

mystic dagger
#

`
class ListStoks extends ListRecords
{
protected static string $resource = StokResource::class;

protected function getHeaderActions(): array
{
    return [
        Actions\CreateAction::make(),
        Action::make('Export')
            ->color('info')
            ->icon('heroicon-o-arrow-down-tray')
            ->action(function ($livewire) {
                dd($livewire->getSelectedTableRecords());
                $name = "laporan-stock-barang-" . date('d-m-y H:i:s') . ".csv";
                return Excel::download(new StockExport(), $name, \Maatwebsite\Excel\Excel::CSV);
            })
            ->openUrlInNewTab(),
    ];
}

}
`
but showing null

rotund plume
mystic dagger
rotund plume
#

Sorry im not sure, maybe someone else would have an idea.

I do know it would work fine if you use a bulk action, then you just get a collection of all the selected objects.
Or if you dont care about any filters you could just query the modal in the header action