Default Table Filter when using Tabs

Ok, so I have a quite a few different number of tabs (customer can actually configure it). Its based on different statuses. The first tab though is always 'All'. Now each status might have a type of 'open' or 'closed'. I have a type filter, but i really only want to use it that on the first tab of 'all' as it doesnt make sense to have it on the others. With that said, I really would like to have the 'All' tab filtered by default. I have
SelectFilter::make('type')
->default()
->visible(function () {
$shouldShowFilter = ($this->activeTab === 'all');

if (! $shouldShowFilter) {
$this->tableFilters['type']['value'] = null;
}

return $shouldShowFilter;
})
->options([
'open' => 'Open',
'closed' => 'Closed',
])
->relationship('status', 'type'),
SelectFilter::make('type')
->default()
->visible(function () {
$shouldShowFilter = ($this->activeTab === 'all');

if (! $shouldShowFilter) {
$this->tableFilters['type']['value'] = null;
}

return $shouldShowFilter;
})
->options([
'open' => 'Open',
'closed' => 'Closed',
])
->relationship('status', 'type'),
, which kind of works as it removes the filter and hides it if you move to another tab, but the problem is that obviously when you come back to the All tab, its now gone. Now the reason i dont just have it as part of the query is that I want to show that its enabled and allow the user to remove it. Thoughts?
0 Replies
No replies yetBe the first to reply to this messageJoin