F
Filament16mo ago
πTeR

Update relationship manager table when edit a record

On my payment edit page I have a Relationship Manager to list all my transactions, when I edit this page I add a new transaction, but my Relationship Table does not update, how to can solve it?
8 Replies
cheesegrits
cheesegrits16mo ago
How are you adding the new transaction? Through a normal CreateAction on the RM headerActions()?
πTeR
πTeROP16mo ago
Im using beforeSave() method on the Edit Page from my Payment
cheesegrits
cheesegrits16mo ago
In that case, you'll probably need to dispatch a refresh event. Although tbh I'm not sure if that still works the same way in v3. Idea being, in the ListFoo page add a listener ...
protected $listeners = ['refreshFoo' => '$refresh'];
protected $listeners = ['refreshFoo' => '$refresh'];
... and then dispatch it from your beforeSave() function ...
$this->dispatch('refreshFoo');
$this->dispatch('refreshFoo');
... but I haven't tried this in a v3 admin panel yet.
LeandroFerreira
LeandroFerreira16mo ago
YourRelationManager.php
#[On('list-updated')]
public function updateList()
{
}
#[On('list-updated')]
public function updateList()
{
}
$this->dispatch('list-updated'); // or $livewire->dispatch('list-updated')
$this->dispatch('list-updated'); // or $livewire->dispatch('list-updated')
πTeR
πTeROP16mo ago
Is this correct @leandro_ferreira ? on my edit I put it on beforeSave() method
...
$this->dispatch('list-updated');
...
$this->dispatch('list-updated');
No description
LeandroFerreira
LeandroFerreira16mo ago
Worked?
πTeR
πTeROP16mo ago
unfortunately it didn't work 😦 Nothing happens when I edit the record
cheesegrits
cheesegrits16mo ago
But isn't ListFoo the actual component that renders the list?

Did you find this page helpful?