开发者

jQuery Sortable: helper option

开发者 https://www.devze.com 2023-02-25 03:00 出处:网络
I have 2 sortable lists, let\'s say \"modules\" and \"available-modules\" $(\".available-modules\").sortable({

I have 2 sortable lists, let's say "modules" and "available-modules"

$(".available-modules").sortable({
    // helper: 'clone'
    // or
    helper: function(e, elt) {
        return elt.clone(true);
    }
})

None of this work: when I drop an item from "available-modules" to "modules", the item from "available-modules" is removed. I thought that using helper: clone would just insert the clone,开发者_如何学Python not the actual item.

Is this my responsability to reinsert the element in the "available-modules" list after inserting it in the other one or is there a problem with my helper option?

Thanks.


It seems like you need something a bit like this demo:

http://jqueryui.com/demos/draggable/#sortable

The drag "source" isn't sortable, just draggable, and makes use of the connectToSortable option.

0

精彩评论

暂无评论...
验证码 换一张
取 消