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
cheesegrits2y ago
How are you adding the new transaction? Through a normal CreateAction on the RM headerActions()?
πTeR
πTeROP2y ago
Im using beforeSave() method on the Edit Page from my Payment
cheesegrits
cheesegrits2y 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
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
πTeROP2y 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
Worked?
πTeR
πTeROP2y ago
unfortunately it didn't work 😦 Nothing happens when I edit the record
cheesegrits
cheesegrits2y ago
But isn't ListFoo the actual component that renders the list?

Did you find this page helpful?