【发布时间】:2012-01-18 12:19:15
【问题描述】:
我在 UI 1.8.6 中使用 this hack 进行了这项工作,但我似乎无法让它在 1.8.17 中工作。
- 我想将列表中的项目拖到可排序的列表中。
- 删除后项目应保留在源列表中(以便可以添加 n 次)
- 当我将项目放入可排序中时,我想获取可排序中已放置项目的实例的句柄。
在 sortable 的接收方法中:
receive: function(e, ui){
// ui.item is the original dragged item, not the clone that gets created when dropped
// ui.helper is a separate clone of the dragged item, it does not get inserted into the sortable
}
所以问题是,我如何处理插入的项目?在调用 receive 时,该项目似乎尚未插入(或创建)。对 jquery UI 进行了更改还是我遗漏了什么?
这是我的代码:
$('form').sortable({
placeholder: "placeholder",
forcePlaceholderSize: true,
receive: function (ev, ui) {
// need handle on dropped item here. ui.item and ui.helper are not it
}
});
$('.draggableTings').draggable({
helper: "clone"
, appendTo: "body"
, revert: "invalid"
, connectToSortable: "form"
});
谢谢
【问题讨论】:
标签: jquery jquery-ui jquery-ui-sortable