How do you make tables communicate with each other.
I want to make an page with two tables, where on the first I have an list of all talk rooms and on the second I have all the participants of the selected room. How do I make it so that both are on the same page and both are made by the filament table builder?
12 Replies
How would you "select" a room? Via the bulk select?
no, an action.
In general the logic would be to dispatch events and listen to them
do you mean with this? https://laravel.com/docs/10.x/events#dispatching-events
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
No I mean Livewire events: https://livewire.laravel.com/docs/events
Laravel
Events | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Because your tables are Livewire components
ah, I see, Thanks, and will try. 👍
Solution
it worked, thanks.
Wanna share your solution for anyone searching this?
sorry, I accidentally selected the wrong post, I wanted to select your post (the livewire link), but i don’t know how to change the solution.
You can't change it after it was selected 😅
But I meant: Do you want to share a bit of code on how you solved this?
sure.
in the dispatcher livewire:
class:
->actions([
Tables\Actions\Action::make('select')
->action(function (ProjectService $record) {
$this->dispatch('select_project', project: $record);
})
])
blade:
<div>
{{ $this->table }}
@livewire('testing-service-list',['project' => $selectedProject])
</div>
in the dispatched livewire:
#[On('select_project')]
public function showSelectedProjectServices($project)
{
$this->project = $project;
}