F
Filamentβ€’2mo ago
Jakub

Refreshing ParentResource Infolist when adding records in RelationManager table

What I want to do When I add a new record on a table that is added via relation manager. I want the parent resource data to update and reflect the new changes. I have a PhoneMembership->balance() calculcator on the infolist, that i would like to get updated without manually refreshing the page each time. Right now, after a new record is added to the table. I would need to manually refresh the page for the new balance to show up. First I tried doing this approach that I found here https://discord.com/channels/883083792112300104/1209193801386827776
Tables\Actions\Action::make('quick-payment')->label('Quick Payment')
->action(function () {
$this->ownerRecord->phoneMembershipRecords()->create([
// stuff
]);

$this->dispatch('$refresh')->to(ViewPhoneMembership::class);
})
Tables\Actions\Action::make('quick-payment')->label('Quick Payment')
->action(function () {
$this->ownerRecord->phoneMembershipRecords()->create([
// stuff
]);

$this->dispatch('$refresh')->to(ViewPhoneMembership::class);
})
Next I tried to do https://discord.com/channels/883083792112300104/1103674797537366167
use Livewire\Component;

->action(function (Component $livewire) {
$this->ownerRecord->phoneMembershipRecords()->create([
//stuff
]);

$livewire->emit('refresh-view-phone-membership');
})
use Livewire\Component;

->action(function (Component $livewire) {
$this->ownerRecord->phoneMembershipRecords()->create([
//stuff
]);

$livewire->emit('refresh-view-phone-membership');
})
On the ViewPhoneMembership I added
protected $listeners = ['refresh-view-phone-membership' => '$refresh'];
protected $listeners = ['refresh-view-phone-membership' => '$refresh'];
I get this error for BadMethodCallException
Solution:
$this->dispatch('updatePhoneMembershipTable'); lol instead emit...
Jump to solution
3 Replies
Jakub
Jakubβ€’2mo ago
If it helps with the context
No description
Jakub
Jakubβ€’2mo ago
- add quick payment which adds a new transaction - emit some event to update accout balance in the top left panel, which is from the PhoneMembershipResource infolist Any help or insight on where I could find the answer is much appreciated πŸ™‚
Solution
Jakub
Jakubβ€’2mo ago
$this->dispatch('updatePhoneMembershipTable'); lol instead emit
Want results from more Discord servers?
Add your server
More Posts
align inputHi, I have a small problem: I would like to align the inputs with each other despite the return to I have to submit the form twice to update the table in a custom page with a table and a fromSo, I'm building a very complicated wizard that I need to use Filament Forms and Table separately inis it possible to make maxvalue in texinput dependant based on select?i want to achieve that max value from text input can change depend on how many qty left in stock frois it possible to group select items from query databaseis it possible to group select from this ```php Select::make('status') ->searchable() ->optiHow do you delete a PDF file from storage after the Edit.(only changing the FileUpload)I am able to replace a pdf file on edit but the previous one does not get removed from Storage. How wizard with many stepsHi, Do you have a solution when you have too many steps in a Wizard ? it exceeds because I have toLogin page on mobile lacks stylingHi when I access http://192.168.1.49:8000/admin or http://192.168.1.49:8000/app on my desktop, I Show relation manager of a relation manager in same viewI have a relation manager with `companies` (resource) and `elements` (relation manager) (image1). EaGet unique ID custom field from relation managerIn the modal from relation manager, I would like to get id on each field. The problem: I have only tignoreRecord for TextColumn with different slugs for each domainHello! I'm fighting for hours with this and maybe just your experience can help me in minutes. **Th