rniemeyer / knockout-sortable

A Knockout.js binding to connect observableArrays with jQuery UI sortable functionality
MIT License
547 stars 128 forks source link

Sortable Tables don't preview/displace elements when dragging #140

Closed gdalam closed 9 years ago

gdalam commented 9 years ago

This plugin is great, I've just run into one minor issue. It seems that when you make a table sortable, as soon as you drag an item the rest of the list collapses as if that item had been removed. It doesn't "displace" the other elements nor give you a preview of where the dragged item will be dropped. This makes it much clunkier and even more difficult to move elements around accurately.

I've made a quick fiddle to demonstrate the problem. The top list uses a table, so the problem occurs when you drag an item. The bottom list does not and works fine.

http://jsfiddle.net/zky2T/3/

rniemeyer commented 9 years ago

@gdalam - You will see a better experience when placing your sortable binding on a tbody inside of your table. What seems to happen (at least in some browsers) when you don't, is that each tr gets automatically wrapped in its own tbody, which causes the issues that you are seeing.

Here is an updated fiddle: http://jsfiddle.net/rniemeyer/rqx5tdhf/

Hope that helps!