F
Filament13mo ago
torriv

showing headerActions based on what tab you are on

I'm trying to show a header action only if you are not on the 'all' tab. when i output $livewire->activeTab in ray(), it updates correctly. so i figured out this behaviour: 1. if i go to the page and try different tabs, nothing happens. 2. if i click on a tab that is not 'all', and then refresh the page, then it works as expected when i click back and forth on different tabs. anyone knows why and how to fix it?
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('packingList.name')->label('Liste'),
TextColumn::make('item')->label('Hva'),
TextColumn::make('quantity')->label('Antall'),
ToggleColumn::make('is_packed')->label('Pakket?'),
])
->headerActions([
Tables\Actions\CreateAction::make()->hidden(function (Livewire $livewire)
{
ray($livewire->activeTab);
return $livewire->activeTab === 'all';
}),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('packingList.name')->label('Liste'),
TextColumn::make('item')->label('Hva'),
TextColumn::make('quantity')->label('Antall'),
ToggleColumn::make('is_packed')->label('Pakket?'),
])
->headerActions([
Tables\Actions\CreateAction::make()->hidden(function (Livewire $livewire)
{
ray($livewire->activeTab);
return $livewire->activeTab === 'all';
}),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
1 Reply
torriv
torrivOP13mo ago
bump
Want results from more Discord servers?
Add your server