F
Filament•17mo ago
Med

Is there a way to undo Repeater item delete?

Hello guy, I'm looking for a way to undo the delete action in the repeater field, similar to Shopify UI.
14 Replies
ZedoX
ZedoX•17mo ago
I don't think so 🤔
Med
MedOP•17mo ago
it's actually possible by mutating the deleteAction, I just need to find a way to apply cua stom style for the deleted items
awcodes
awcodes•17mo ago
Why not just use a confirmation before deleting? that way the user acknowledges it and you don’t have to over complicate it with data versioning.
Med
MedOP•17mo ago
the variants list is auto-generated, if the user removed one by mistake there is no way to recreate it
awcodes
awcodes•17mo ago
Yea, but with a confirmation it won’t be by accident. 🙂
Med
MedOP•17mo ago
yes, I agree with you. the confirmation solution may work as well
awcodes
awcodes•17mo ago
Just throwing it out as an option. Do whatever your app requirements are. Just don’t forget about the simple options too. 🙂
Med
MedOP•17mo ago
I need a way to know if the current resource is being created or updated, so during the creation it will show this UI, and when updating it will delete the record with confirmation
Patrick Boivin
Patrick Boivin•17mo ago
Hi @Med, I'm working on something similar (not really a similar problem, but the idea of having different "row types" in a single Repeater). I started with a regular Repeater, moved to #awcodes-table-repeater and eventually rewrote it into a completely custom form field :
Patrick Boivin
Patrick Boivin•17mo ago
It's not easy... I needed to get comfortable with custom fields and dig into the base Repeater to understand how to make use of form events. But in the end, I found it easier to create something tailored to my use-case.
Med
MedOP•17mo ago
looks amazing, I'll give it a shot. I'm sure i'll need it in other parts of the app so this component can undo relationship delete?
Patrick Boivin
Patrick Boivin•17mo ago
No sorry for the confusion. My component is not quite solving the same problem as yours, but I think the general approach might be useful for you. What I'm seeing in your screenshot is basically 2 "row types" in the Repeater : regular rows and "deleted" rows that be restored into regular rows (if that makes any sense...)
Med
MedOP•17mo ago
OK I got it, Thanks for the suggestion I appreciate it
Dwayne
Dwayne•11mo ago
Hey Mad! How did you ensure that the variants are created automatically? So the Red / large, Red / small etc.

Did you find this page helpful?