johnny / jquery-sortable

A flexible, opinionated sorting plugin for jQuery
http://johnny.github.io/jquery-sortable/
Other
1.52k stars 441 forks source link

Unable to drag outer list items into the nested group, plus placeholders stick #211

Closed michaelsoriano closed 8 years ago

michaelsoriano commented 8 years ago

I'm having a trouble figuring out how to make the outer list items being dragged into the nested ul. I can drag items FROM the children - OUT - but not in:

jquery-sortable-issue

Also, the placeholder marker sticks. Sometimes 2 or three appears and it just stays.

I have the code: https://jsfiddle.net/mks6804/56ufc79p/11/

Any help is appreciated.

joshuaadickerson commented 8 years ago
jquery-sortable.js:104 Uncaught TypeError: Cannot read property 'group' of undefined
groupDefaults.onDrop @ jquery-sortable.js:104
container_config.onDrop @ dispatch.js:47
ContainerGroup.drop @ jquery-sortable.js:303
m.isFunction.e @ jquery.js:548
m.event.dispatch @ jquery.js:4670
r.handle @ jquery.js:4338
joshuaadickerson commented 8 years ago

I have the same problem and that's the error I am getting

michaelsoriano commented 8 years ago

I figured it out. I just noticed this in the documentation

"Heads up" There is no on-the-fly creation of sublists. Only list items that contain a sublist are drop targets.

So what I had to do is add an empty OL / UL into the item I want to drop in.

Also, for the "sticky" placeholders - that's because the way I initialize the plugin should be more specific. I was doing $('div ul') = which is what's causing the duplicate placeholders all over the place.

Thanks for the plugin. + star.