Nestable jQuery plugin - disable dragging between lists

假装没事ソ 提交于 2019-12-02 01:45:42

问题


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

There is an option group in documentation https://github.com/RamonSmit/Nestable

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

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.


回答1:


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

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

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


来源:https://stackoverflow.com/questions/43093585/nestable-jquery-plugin-disable-dragging-between-lists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!