I have seen more and more of the websites that offers a undo option after pressing a delete button. How is the logic done behind the button?
Is the item deleted by javascript and "dissapears" from the users screen and a scheduled delete added, that gives the user time to undo it or how does it work?
What are the other options to offer the users an undo feature?
That really depends on the application's structure.
One common way is to not delete a record/an item, but mark it as deleted internally (using a boolean column), excluding it from all queries and lists.
If you have a node structure, you may want to move an item into a "recycle bin" node from where it can be restored to its original location.
In both variations, deleted items would be cleaned out from time to time - either based on time (delete after 3 weeks) or volume (keep max. 50 deleted items, then start deleting the oldest ones.)
I would agree with Pekka, but additionally suggest that you make the column in question a datetime field, as opposed to boolean (call it "deleted on" or something).
This would easily enable the "delete after n weeks" functionality, as well as let you actually "undo" rather than simply "undelete".
In HTML5 there will be a Undo implementation!
But nevertheless as Pekka said, your application must track what is done to "undo" it. One technical solution is, to save revisions of a document or of data. So when a user wants to undo something, just the previous revision is loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With