如何在 jqueryui 中撤消/重做可排序操作?

发布于 2024-08-17 07:08:50 字数 167 浏览 2 评论 0原文

我有一个可排序列表(jquery ui),您能否建议是否可以基于可排序实现“撤消/重做”?

想象一下,一个项目被拖动到一个新的占位符,然后我单击“撤消”按钮,该项目将移动到其原始位置。如果我单击“重做”按钮,该项目将移动到新的占位符。

也许有人知道如何执行此操作或其他操作。 提前致谢。

I have a sortable list(jquery ui), could you advise if it is possible to implement 'undo/redo' base on sortable?

Imagine that, a item is dragged to a new placeholder, then I click "undo" button and the item will move to its original position. If I click "redo" button and the item will move to that new placeholder.

Maybe someone knows how to do this or maybe something else.
thanks in advance.

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

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

发布评论

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

评论(1

三人与歌 2024-08-24 07:08:50

每次移动后(在 update 上),您可以存储序列化(或使用toArray) 在变量中排序,然后使用它在发生以下情况时重新排序您的项目一个“撤消”。事实上,您可以将序列化的数据推送到数组中,从而使您能够多次“撤消”。

After each move (on update), you could store the serialized (or use toArray) order in a variable, and then use that to re-order your items in the event of an "undo." In fact, you could push the serialized data onto an array, giving you the ability to "undo" several times.

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