jquery ui 拖动和排序 - 出现 2 次放置的项目
请在这里检查我的问题 - http://jsfiddle.net/EhQZH/17/
描述:我有三个列表 A、B 和 C,列表 B 嵌套在列表 A 内。列表(A 和 B)都可以接受列表 C 中的列表项。
当我将列表项从 C 拖动到列表 B 时,列表项就会包含在内两次,一次在 B,另一次答:我想避免这种情况。我希望列表项在 A 或 B 中出现一次,然后将其删除。
我已经应用了排序、拖放等。但我认为我做错了什么,找不到它。
请让我知道您的建议。
Please check my problem here - http://jsfiddle.net/EhQZH/17/
Description: I have a three list A, B and C, List B is nested inside list A. Both the list(A and B) can accept a list item from list C
When I am dragging list item from C to list B then the list item is included twice, one in B and another A. I want to avoid this. I want a single occurence of list item in A or B, on which it is dropped.
I have applied sorting, dragging, dropping etc. But I think I have done something wrong, can't find it.
Please let me know your suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能找到问题所在。与div中的div类似。如果您将鼠标光标移到对象 #secondul 上,根据浏览器,它仍然位于对象 #firstul 中。如果您将代码更改为如下所示,您可以看到它更好:
和
。
另一件事是,将 Item3 拖到第二个列表中后,jquery-ui.js 中将引发错误。至于错误消息,我有这样的理论:代码将尝试从源访问对象。根据上述情况,该项目已不存在。它已经被移至#firtul。
I could find the problem. It is similar with div in a div. If you move your mouse cusor over the object #secondul, it is still in the object #firstul according the browsers. You can see it better if you change your code as like as following:
and
.
Another thing is, after dragging the Item3 into the second list, an error in jquery-ui.js will be fired. As concerned as the error message, I've got the theory the code will try to access the object from the source. Based on the situation above, the item does not exists anymore. It has been already moved to the #firtul.