“撤消删除”在网络应用程序中?

发布于 2024-09-04 18:08:39 字数 144 浏览 3 评论 0原文

我看到越来越多的网站在按下删除按钮后提供撤消选项。按钮背后的逻辑是如何完成的?

该项目是否被 javascript 删除并从用户屏幕中“消失”,并添加了计划删除,以便用户有时间撤消它,或者它是如何工作的?

为用户提供撤消功能的其他选项有哪些?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

菩提树下叶撕阳。 2024-09-11 18:08:39

这实际上取决于应用程序的结构。

一种常见的方法是不删除记录/项目,而是在内部将其标记为已删除(使用布尔列),将其从所有查询和列表中排除。

如果您有节点结构,您可能希望将项目移至“回收站”节点,从该节点可以将项目恢复到其原始位置。

在这两种变体中,已删除的项目都会不时地被清除 - 根据时间(3 周后删除)或数量(最多保留 50 个已删除的项目,然后开始删除最旧的项目。)

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

孤独患者 2024-09-11 18:08:39

我同意 Pekka 的观点,但另外建议您将相关列设为日期时间字段,而不是布尔值(称其为“删除日期”或其他字段)。

这将轻松启用“n 周后删除”功能,并让您真正“撤消”而不是简单地“撤消删除”。

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

浮生未歇 2024-09-11 18:08:39

在 HTML5 中将会有一个撤消实现

但无论如何,正如佩卡所说,您的应用程序必须跟踪“撤消”它所做的事情。一种技术解决方案是保存文档或数据的修订。因此,当用户想要撤消某些操作时,只需加载先前的修订版本

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文