Access table filter in togglable
Is there a way around this error I'm getting when trying to access the filter inside
toggleable
Typed property Filament\Resources\Products\ListRecords::$cachedTableFilters must not be accessed before initialization
I guess 'toggleable' form is setup before the table filters.
3 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I couldn't get that to work but you got me searching and I found that I can call
$livewire->cacheTableFilters()
thanks
That' s now working although the 'toggleable' form is not reactiveHey guys,
I have widget Staff Widget. Depending on the role which user is logged in, I have to create pre-select filter in the table.
So this is StaffWidget.php in widgets folder :
protected function getTableColumns(): array
{
return [
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('roles.name')
];
}
and this is the code from UserResource.php :
Forms\Components\TextInput::make('name')->required(),
Forms\Components\TextInput::make('email')->required(),
Forms\Components\Select::make('organisation')->relationship('organisation', 'name'),
Bottom line, If I am logged in as a customer, role "customers" should be pre-selected on the Users overview page.
Thanks in advance!
@all