[plugins-dev] How to get resource column in Filamentv3

I am trying to upgrade a plugin to support v3. In v2 we were able to get table column from specified resource using:
use Filament\Resources\Table;

$columns = $this->resource::table(Table::make())
->getColumns();
use Filament\Resources\Table;

$columns = $this->resource::table(Table::make())
->getColumns();
When I try following in Filament v3 i get an error:
use Filament\Tables\Table;

// I am passing $this here because in v3 make requires HasTable $livewire param.
$columns = $this->resource::table(Table::make($this))
->getColumns();
use Filament\Tables\Table;

// I am passing $this here because in v3 make requires HasTable $livewire param.
$columns = $this->resource::table(Table::make($this))
->getColumns();
Error: Property [$isCachingForms] not found on component
Solution:
I was able to figure it out. I was showing this table inside a filament resource table by using a hook. And based on new blade layouts i needed to pass livewire property. So in my case ['livewire' => $this] worked. ```php public function render(): View {...
Jump to solution
2 Replies
Mansoor Khan
Mansoor KhanOP17mo ago
I added HasForms contract and InteractsWithForms trait. Now i am getting following error:
Undefined variable $livewire at .../vendor/filament/filament/resources/views/components/layout/index.blade.php:5)
Undefined variable $livewire at .../vendor/filament/filament/resources/views/components/layout/index.blade.php:5)
Solution
Mansoor Khan
Mansoor Khan17mo ago
I was able to figure it out. I was showing this table inside a filament resource table by using a hook. And based on new blade layouts i needed to pass livewire property. So in my case ['livewire' => $this] worked.
public function render(): View
{
return view(static::getView(), $this->getViewData())
->layout(static::$layout, ['livewire' => $this]);
}
public function render(): View
{
return view(static::getView(), $this->getViewData())
->layout(static::$layout, ['livewire' => $this]);
}
Want results from more Discord servers?
Add your server