F
Filament12mo ago
gizmojo

Only show header action if table has records

Is there a better(performance/cached) way of only showing a header action if the table has records?
$table->query()
->columns([])
->headerActions([
ExportAction::make('Export')
->visible(fn () => $this->table->getRecords()->isNotEmpty()),
$table->query()
->columns([])
->headerActions([
ExportAction::make('Export')
->visible(fn () => $this->table->getRecords()->isNotEmpty()),
Solution:
So, looking into the table component, it calls $records = $getRecords() and also uses count($records) ... so, what you're doing is probably fine.
Jump to solution
2 Replies
Solution
DrByte
DrByte12mo ago
So, looking into the table component, it calls $records = $getRecords() and also uses count($records) ... so, what you're doing is probably fine.
Want results from more Discord servers?
Add your server