NullVoxPopuli
NullVoxPopuli

Reputation: 65103

jQuery: problem with sortable items: can't be dropped onto empty lists

Here is an example double list thing: http://jsfiddle.net/xhdUW/

If one of the parent lists already has content, the list items will transfer between the parent lists easily. But if one of the parent lists is empty, the list items will not go into the empty parent list.

The docs on .sortable say that transferring to empty lists should be enabled by default: http://jqueryui.com/demos/sortable/#empty-lists , though, even when I specify dropOnEmpty: true, I get the same behavior.

Upvotes: 13

Views: 10614

Answers (2)

marc
marc

Reputation: 6223

You have heavily abused the sortable API. See http://jsfiddle.net/6xkQE/ how it gets done right.

  1. You have to use connectWith with what you want to connect!

  2. As @hadvig mentioned, you have to set min-height!

Upvotes: 4

hadvig
hadvig

Reputation: 1106

Your empty list have no height and no vertical padding. Try to add something from list:
padding-top
padding-bottom
min-height

Upvotes: 31

Related Questions