F
Filament7mo ago
cakan

Refresh repeater from child field

I have a Repeater that displays a list of documents. Each document is represented as a custom section with it's own delete button. But when I delete a record, repeater doesn't refresh. How do I refresh repeater from the child component? This is what I have tried but with no luck.
Repeater::make('documents')
->relationship()
->live()
->deletable(false)
->addable(false)
->registerListeners([
'refreshDocuments' => [
function (Repeater $component): void {
dd('test');
},
],
])
->schema([
Document::make('document_path')
->live()
->registerActions([
\Filament\Forms\Components\Actions\Action::make('deleteDocument')
->requiresConfirmation()
->action(function ($action, $record) {
$record->delete();
})
->after(fn ($livewire) => $livewire->dispatch('refreshDocuments'))
])
])
Repeater::make('documents')
->relationship()
->live()
->deletable(false)
->addable(false)
->registerListeners([
'refreshDocuments' => [
function (Repeater $component): void {
dd('test');
},
],
])
->schema([
Document::make('document_path')
->live()
->registerActions([
\Filament\Forms\Components\Actions\Action::make('deleteDocument')
->requiresConfirmation()
->action(function ($action, $record) {
$record->delete();
})
->after(fn ($livewire) => $livewire->dispatch('refreshDocuments'))
])
])
When I add new document, repeater refreshes. But when I delete it, it remains in the Repeater.
1 Reply
رجل الجمبري
Did you find a solution?
Want results from more Discord servers?
Add your server