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.
When I add new document, repeater refreshes. But when I delete it, it remains in the Repeater.
8 Replies
Did you find a solution?
Hey man. Have you gotten a solution to this?
Shouldn't
deletable
do that?a custom delete from ->deleteAction() which works but need to refresh the repeater component
But the repeater is a relationship, the default delete action should handle it by default. Keeping in mind though that the repeater will not persist the delete until the form is saved. But the default will remove it from the array via JS until it is saved.
yes that works exactly has intented. But there was a need to allow deletion only on certain condition, hence the deleteAction() for manual delete. Which works fine except it doesn't remove it from array via JS. But it'd already be removed from the table.
At least in my mind the condition delete might be better handled in a policy. But I could be wrong.
I think the underlying issue you’re running into though is that the state on delete, is handled via js vs an actual server call. Thus the state isn’t getting updated at the livewire level and not resulting in a dom diff.
yes but in my case i do not want to take it to authorization level
exactly. is there a way to refresh the state after delete?