无法使用Scriptaculous Sortables将项目拖到空列表中

时间:2022-10-03 09:44:44

I have three unordered lists that have been created as Scriptaculous Sortables so that the user can drag items within the lists and also between them:

我有三个无序列表已创建为Scriptaculous Sortables,以便用户可以在列表中以及它们之间拖动项目:

var lists = ["pageitems","rowitems","columnitems"];    
Sortable.create("pageitems", { dropOnEmpty: true, containment: lists, constraint: false });
    Sortable.create("rowitems", { dropOnEmpty: true, containment: lists, constraint: false });
    Sortable.create("columnitems", { dropOnEmpty: true, containment: lists, constraint: false });

How can I make it so that if the user drags all the items out of a list, they're able to put them back again? At the moment it won't allow items to be dragged onto an empty list.

我怎样才能做到这一点,如果用户从列表中拖出所有项目,他们能够再次将它们放回去?目前它不允许将项目拖到空列表中。

3 个解决方案

#1


3  

Maybe the empty list has no height, and therefore no droppable area available. If that's the case, perhaps you just need to set a minimum height, or some padding on the block.

也许空列表没有高度,因此没有可用的可放置区域。如果是这种情况,也许你只需要在块上设置最小高度或一些填充。

#2


1  

add dropOnEmpty:true to the options parameters.

add dropOnEmpty:true to options parameters。

#3


-1  

Make sure your target list is styled float:left

确保您的目标列表的样式为float:left

I had a similar experience today.

我今天也有类似的经历。

#1


3  

Maybe the empty list has no height, and therefore no droppable area available. If that's the case, perhaps you just need to set a minimum height, or some padding on the block.

也许空列表没有高度,因此没有可用的可放置区域。如果是这种情况,也许你只需要在块上设置最小高度或一些填充。

#2


1  

add dropOnEmpty:true to the options parameters.

add dropOnEmpty:true to options parameters。

#3


-1  

Make sure your target list is styled float:left

确保您的目标列表的样式为float:left

I had a similar experience today.

我今天也有类似的经历。