F
Filament5mo 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.
0 Replies
No replies yetBe the first to reply to this messageJoin