Nestable jQuery插件 - 禁用列表之间的拖动 [英] Nestable jQuery plugin - disable dragging between lists

查看:739
本文介绍了Nestable jQuery插件 - 禁用列表之间的拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在jQuery可嵌套插件中禁用两个列表之间的拖动。

I would like to disable dragging between two lists in jQuery nestable plugin.

文档
中有一个选项 group https://github.com/RamonSmit/Nestable

组组ID允许在列表之间拖动(默认为0)

group group ID to allow dragging between lists (default 0)

所以我将其更改为元素ID

So I change that to element id

$('.dd').nestable({
    maxDepth: 1,
    group: $(this).attr('id')
});

但它不起作用。用户可以根据需要在两个嵌套之间拖放项目。

But it's not working. User can drag and drop items between two nestables as he wants.

推荐答案

在当前代码中, this 指的是父作用域,比如 window document ,而不是 .dd

In your current code, this refers to the parent scope, somethings like window or document, not .dd.

你必须为每个列表调用nestable,试试这个:

You have to call nestable for each list, try this:

$('.dd').each(function(){
    $(this).nestable({
        maxDepth: 1,
        group: $(this).prop('id')
    });
});

这篇关于Nestable jQuery插件 - 禁用列表之间的拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆