【发布时间】:2010-10-04 10:45:49
【问题描述】:
我从上周五开始就在寻找这个,找不到任何解决方案。我考虑并尝试了几次的一件事是首先构建函数,其中列表中的所有项目,包含该项目,实际上应该被排除在其他列表中之外的项目有权在该列表中移动,并且稍后构建另一个函数,其中所有项目都准备好也被移动到其他列表中,但某个项目被排除在外。
但似乎你不能用 jquery 为一个列表编写两个函数,或者这可能吗?
无论如何,我的请求实际上在标题中得到了最好的描述,而我直到现在才得到任何解决方案。有人知道如何解决这个问题吗?
问候,马斯切克
编辑:
这里有一些代码:
$("#tx-sortable2").sortable({
items: \'li:not(.tx-header)\',
connectWith: \'#tx-sortable2,#tx-sortable3\',
helper: \'clone\',
opacity: 0.6,
forceHelperSize: true,
placeholder: \'tx-highlight\',
revert: \'invalid\',
update: function() {
var order = $(this).sortable("serialize") + \'&action=bla=blubb\';
$.ajax({
url: \'index.php?bla=blubb\',
type: \'POST\',
data: order,
timeout: 50000,
beforeSend: function() {
$("#tx-response").show();
$("#tx-response").fadeOut(2000);
}
});
}
在此示例中,#tx-sortable2 中的所有 li-items 都可以移动到列表 #tx-sortable3 和列表 #tx-sortable2 本身中,这就是 connectWith 的含义。再次,我的问题是,我如何使单个 li-item 在其自己的列表中可排序(此处为#tx-sortable2),但防止它被拖到另一个列表中?
【问题讨论】:
-
我不明白这个问题 - “排除项目与其他列表连接并在其自己的列表中排序”。不清楚您想要什么或问题是什么,例如“被连接”是什么意思?