F
Filament8mo ago
mpiet

Action in custom modal content: Update modal content after action performed?

I have a page that renders records. I have an action to open a modal. I pass a subset of records to this modal action. I render the subset of records in the custom modal content. I also added an action to delete a single record. The overall page updates, and the record is removed. But inside the custom modal content I still see the record. How can I update the modal content? Or make it reactive? Here's some code:
{{
($this->editRates)([
'rates' => $day['rates']
])
}}
{{
($this->editRates)([
'rates' => $day['rates']
])
}}
public function editRates(): Action
{
return Action::make('editRates')
->registerModalActions([
$this->removeRate(),
])
->modalContent(
function (Action $action) {
return view('edit-rates', [
'action' => $action
]);
}
);
}
public function editRates(): Action
{
return Action::make('editRates')
->registerModalActions([
$this->removeRate(),
])
->modalContent(
function (Action $action) {
return view('edit-rates', [
'action' => $action
]);
}
);
}
@foreach($action->getArguments()['rates'] as $rate)
<div>
{{ ($action->getModalAction('removeRate'))([ 'id' => $rate['id'] ]) }}
</div>
@endforeach
@foreach($action->getArguments()['rates'] as $rate)
<div>
{{ ($action->getModalAction('removeRate'))([ 'id' => $rate['id'] ]) }}
</div>
@endforeach
1 Reply
mpiet
mpietOP8mo ago
I solved it by passing only a reference, and querying and filtering the modal content records live.
Want results from more Discord servers?
Add your server