© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
howdu

Testing table set activeTab and toggle all columns

Currently setting the toggle session manually but wondering if that's a way of making this dynamic?
session(['tables' => ['ListProducts_toggled_columns' => ['name' => true]]]);
session(['tables' => ['ListProducts_toggled_columns' => ['name' => true]]]);


But how would you set the active tab?
 $products = Collection::factory()->count(3)->create([
    'type' => 'Group'
]);

Collection::factory()->count(3)->create([
    'type' => 'Another Group'
])

livewire(ListProducts::class)
    ->assertCountTableRecords(3)
    ->assertCanSeeTableRecords($products)
    ->sortTable('name')
 $products = Collection::factory()->count(3)->create([
    'type' => 'Group'
]);

Collection::factory()->count(3)->create([
    'type' => 'Another Group'
])

livewire(ListProducts::class)
    ->assertCountTableRecords(3)
    ->assertCanSeeTableRecords($products)
    ->sortTable('name')


E.g
public function getTabs(): array
{
  return [
    Tab::make('Test')
     ->modifyQueryUsing(fn (Builder $query) => $query->where('type', 'Group'))
  ];
}
public function getTabs(): array
{
  return [
    Tab::make('Test')
     ->modifyQueryUsing(fn (Builder $query) => $query->where('type', 'Group'))
  ];
}
Solution
Cheers I found it was actually possible to set the property and the hook event for
updatedActiveTab
updatedActiveTab
is called very easy/cool:
livewire(ListProducts::class)
        ->assertCountTableRecords(4)
        ->set('activeTab', 2)
        ->assertCountTableRecords(2)
livewire(ListProducts::class)
        ->assertCountTableRecords(4)
        ->set('activeTab', 2)
        ->assertCountTableRecords(2)
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Toggle all table columns on / off
FilamentFFilament / ❓┊help
3mo ago
TablesRenderHook after table filter / toggle columns
FilamentFFilament / ❓┊help
6mo ago
Toggle columns grid
FilamentFFilament / ❓┊help
3y ago
Testing / code covering toggled table columns
FilamentFFilament / ❓┊help
8mo ago