Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Undoing deletes" in webapplication?

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?

like image 693
Industrial Avatar asked Jun 07 '10 11:06

Industrial


3 Answers

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.)

like image 182
Pekka Avatar answered Oct 04 '22 20:10

Pekka


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".

like image 26
Simon Scarfe Avatar answered Oct 04 '22 21:10

Simon Scarfe


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.

like image 24
powtac Avatar answered Oct 04 '22 21:10

powtac