Access to Table records in Groups closure

I have the following table
public function table(Table $table): Table
{
return $table
->query(Issue::query())
->groups([
Group::make('status')
->getDescriptionFromRecordUsing(function ($records): string {
// Can I access all the records here?
})
->collapsible()
]);
}
public function table(Table $table): Table
{
return $table
->query(Issue::query())
->groups([
Group::make('status')
->getDescriptionFromRecordUsing(function ($records): string {
// Can I access all the records here?
})
->collapsible()
]);
}
Is there a way to access all the records on the table (after filters are applied)? Ideally, I'd like to access them in the getDescriptionFromRecordUsing
Solution:
Ok I found a solution to this. You can do something like
$this->table->getRecords();
$this->table->getRecords();
Not sure if there are any downsides to this but is seems to work. Hope it helps....
Jump to solution
4 Replies
Solution
ChesterS
ChesterS14mo ago
Ok I found a solution to this. You can do something like
$this->table->getRecords();
$this->table->getRecords();
Not sure if there are any downsides to this but is seems to work. Hope it helps.
toeknee
toeknee14mo ago
You will likely want getFilteredTableRecords or similar when using filtering?
ChesterS
ChesterSOP14mo ago
@toeknee I tried it and I'm getting Method Filament\Tables\Table::getFilteredTableRecords does not exist. getRecords seems to give me the correct results though 🤔
toeknee
toeknee14mo ago
Sorry you are right, I was recalling the query method opposed to the records method
Want results from more Discord servers?
Add your server