© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
4 replies
frame

Custom resource page $this->record null when searching/sorting

The table renders fine initially, but when trying to sort or search
$this->record
$this->record
is null. Am I missing some trait or something? 🤔
Same question as this removed one ❓┊helpTable builder records are null after update

<?php

namespace App\Filament\Instructors\Resources\GroupResource\Pages;

use App\Filament\Instructors\Resources\GroupResource;
use App\Models\ExerciseResult;
use App\Models\Group;
use Filament\Actions\Concerns\InteractsWithRecord;
use Filament\Actions\Contracts\HasRecord;
use Filament\Resources\Pages\Page;
use Filament\Tables;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;

class SimpleResults extends Page implements HasRecord, HasTable
{
    use InteractsWithRecord;
    use InteractsWithTable;

    public function mount(string $record): void
    {
        $this->record = Group::where('uuid', $record)->firstOrFail();
    }

    protected static string $resource = GroupResource::class;

    protected static string $view = 'filament.instructors.resources.group-resource.pages.simple-results';

    public function getModel(): string
    {
        return Group::class;
    }

    public function table(Table $table)
    {
        return $table
            ->query(function () {
                dump($this->record); // null if searching/sorting

                return ExerciseResult::forGroup($this->record);
            })
            ->columns([
                Tables\Columns\TextColumn::make('created_at')
                    ->label('Created at')
                    ->sortable()
                    ->searchable(),
            ])
            ->actions([]);
    }
}
<?php

namespace App\Filament\Instructors\Resources\GroupResource\Pages;

use App\Filament\Instructors\Resources\GroupResource;
use App\Models\ExerciseResult;
use App\Models\Group;
use Filament\Actions\Concerns\InteractsWithRecord;
use Filament\Actions\Contracts\HasRecord;
use Filament\Resources\Pages\Page;
use Filament\Tables;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;

class SimpleResults extends Page implements HasRecord, HasTable
{
    use InteractsWithRecord;
    use InteractsWithTable;

    public function mount(string $record): void
    {
        $this->record = Group::where('uuid', $record)->firstOrFail();
    }

    protected static string $resource = GroupResource::class;

    protected static string $view = 'filament.instructors.resources.group-resource.pages.simple-results';

    public function getModel(): string
    {
        return Group::class;
    }

    public function table(Table $table)
    {
        return $table
            ->query(function () {
                dump($this->record); // null if searching/sorting

                return ExerciseResult::forGroup($this->record);
            })
            ->columns([
                Tables\Columns\TextColumn::make('created_at')
                    ->label('Created at')
                    ->sortable()
                    ->searchable(),
            ])
            ->actions([]);
    }
}
Solution
Actually did not work I just messed up. What really worked is setting additional
public MyModel $myRecord;
public MyModel $myRecord;
in the page and setting that on mount and using that instead of
$this->record
$this->record
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Custom page with resource record error
FilamentFFilament / ❓┊help
14mo ago
Searching Record
FilamentFFilament / ❓┊help
3y ago
Custom record pass to recordActions of resource page
FilamentFFilament / ❓┊help
4mo ago
custom page(non resource page)
FilamentFFilament / ❓┊help
2y ago