Sort within group in table

Hi, I've got the following table:
public static function table(Table $table) : Table
{
return $table
->defaultGroup('project.name')
->columns([
Grid::make([
'lg' => 5,
])->schema([
TextColumn::make("created_at")->color('gray'),
TextColumn::make("name")
->extraAttributes([ 'class' => 'font-bold' ]),
TextColumn::make("description"),
TextColumn::make("activity.url")
->label("URL")
])
])
->actions([
Action::make('complete')
->hiddenLabel()
->icon('jam-circle')
->action(fn (Task $task) => $task->delete())
->visible(fn (Task $task) => ! $task->deleted_at)
,
Action::make('reopen')
->hiddenLabel()
->icon('jam-circle-f')
->action(fn (Task $task) => $task->restore())
->visible(fn (Task $task) => $task->deleted_at),
])
->modifyQueryUsing(fn (Builder $query) => $query->with('activity')->with('project')->withTrashed()->orderBy('deleted_at', 'asc'));
}
public static function table(Table $table) : Table
{
return $table
->defaultGroup('project.name')
->columns([
Grid::make([
'lg' => 5,
])->schema([
TextColumn::make("created_at")->color('gray'),
TextColumn::make("name")
->extraAttributes([ 'class' => 'font-bold' ]),
TextColumn::make("description"),
TextColumn::make("activity.url")
->label("URL")
])
])
->actions([
Action::make('complete')
->hiddenLabel()
->icon('jam-circle')
->action(fn (Task $task) => $task->delete())
->visible(fn (Task $task) => ! $task->deleted_at)
,
Action::make('reopen')
->hiddenLabel()
->icon('jam-circle-f')
->action(fn (Task $task) => $task->restore())
->visible(fn (Task $task) => $task->deleted_at),
])
->modifyQueryUsing(fn (Builder $query) => $query->with('activity')->with('project')->withTrashed()->orderBy('deleted_at', 'asc'));
}
That works well, but groups by project first, then by the task deleted status. So you get: Project A Undeleted Task A1 Undeleted Task A2 Project B Undeleted Task B1 Undeleted Task B2 Project A Deleted Task A3 Deleted Task A4 Project B Deleted Task B3 Deleted Task B4 What I'd like to get to is: Project A Undeleted Task A1 Undeleted Task A2 Deleted Task A3 Deleted Task A4 Project B Undeleted Task B1 Undeleted Task B2 Deleted Task B3 Deleted Task B4 Anyone know how to do this?
2 Replies
Adam Holmes
Adam Holmes4w ago
Hi @_andypeacock did you get anywhere with this?
_andypeacock
_andypeacockOP4w ago
No, in the end I went for a custom blade file, as it wasn't a typical filament table page anyway.
Want results from more Discord servers?
Add your server