连接列表控件

时间:2012-04-27 17:28:11

标签: javascript jquery

抱歉,我的英文谷歌翻译。我有三个连接列表

$( ".listaAvisosConectados" ).sortable({
    connectWith: ".listaAvisosConectados",
    dropOnEmpty:true,

    }).disableSelection();

在线示例:http://test.vertudemo.com/

我需要实现任何元素都可以添加到红色列表中,但列表项不能在相反的列表中添加绿色或蓝色。红色接受所有。绿色仅接受绿色和蓝色仅蓝色。

我尝试了几种但不能做到的。

如果我为每个列表设置一个不同的类绿色和红色。红色列表和添加两个类不能很好地工作。

1 个答案:

答案 0 :(得分:0)

看起来有一种“取消”方法可以用来响应“接收”事件 - 例如(伪代码)

bluelist.sortable(
recieve: function(event, ui){
if(ui.element.class == "green"){ //I don't remember exactly how to get the element off the top of my head, but I think it's something like ui.element
$(this).sortable('cancel');
}}