How do I duplicate item when using jquery sortable?

后端 未结 6 608
孤街浪徒
孤街浪徒 2020-11-29 20:16

I am using this method http://jqueryui.com/demos/sortable/#connect-lists to connect two lists that i have. I want to be able to drag from list A to list B but when the item

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 21:03

    I know this is old, but I could not get Erez's answer to work, and Thorsten's didn't cut it for the project I need it for. This seems to work exactly how I need:

    $("#sortable2, #sortable1").sortable({
        connectWith: ".connectedSortable",
        remove: function (e, li) {
            copyHelper = li.item.clone().insertAfter(li.item);
            $(this).sortable('cancel');
            return li.clone();
        }
    }).disableSelection();
    

提交回复
热议问题