A way to toggle the scrolling of a datatable when using a draggable link?
A way to toggle the scrolling of a datatable when using a draggable link?
I'm looking for a way to toggle the scrolling of a datatable when using a draggable link.
Example:http://jsfiddle.net/sqwgs6wb/8/
Using jqueryUI I can detect when an item is being dragged and when it is done being dragged but the problem I'm running into is that the contents of the table shift around when I want to drag a link onto a drop area. Thus losing their place in the table.
I would very much like the contents of the table to not move when a user drags a draggable item from the datatable.
This question has an accepted answers - jump to answer
Answers
Edit Sorry, I didnt read all the way through.
Last I heard, its not possible to toggle the
scrollY
orscrollX
via the API, without destroying the entire table... But dont take my word for it, maybe someone else found a wayThe only thing I could think of would be to listen for the drag event (like you stated), when it starts, get the current scroll position, and whenever the scrollY starts to change, set it back to the position it was, then stop that when the drag event is stopped.
Its totally out of scope for the DataTables API, but its definitely doable via jQuery
To be honest, I think in this case you would be better asking the jQuery UI people since it is that component which is causing the scrolling to occur.
It also looks like you need to have the element attached to the
body
rather than in the scrolling container if you want to make it draggable outside of the offset parent.Actually - scanning the jQuery UI documentation I found an
appendTo
option which resolves both points: http://jsfiddle.net/sqwgs6wb/9/ .Allan