Creating a child Table class that uses inheritance on a List page.

Hi All,

I have been using inheritance to create custom classes for Filament objects I want to customize. For example:

class SectionForInfolist extends \Filament\Infolists\Components\Section
{
    public function myFeature(): static
    {
        // Do stuff
        return $this;
    }
}


However, I am having trouble figuring out how to use a custom Table class, because of the way that Filament "makes" tables and then injects them:

class ListPage extends ListRecords
{
    public function table(MyCustomTable $table): MyCustomTable
    {
    }
}

Doing this results in a "must be compatible with Filament\Tables\Table" error. Diving into the source shows that the Table is made elsewhere and injects some Livewire stuff.

In my case, I can't use the global settings as per the docs because I want to create custom methods in the child class not just define defaults.

Does anyone have experience with this and can lend some advice on how to use a custom Table class that can be used on a List page?
Was this page helpful?