javascript
Written: Jun-2023
Implementing a drag sorter on a <table>
After experimenting with a number of drag sorter classes specifically for use with <table>
row elements, the ability to drag in long lists where page-scroll was necessary seemed to be a deciding factor, and the jquery sortable class seemed to provide the required solution.
demo.html :: css
demo.html :: javascript
demo.html :: javascript
demo.html :: html
demo.html :: javascript
demo.html :: javascript
$('#mytable tbody').sortable({
code adds flashfade
to the dropped row in order to make it standout momentarily, but this is obviously optional.I have also coded a doSaveNewOrder
function that re-sequences the rowdragger-order field in order to take that further when saving this information on a database or on the browser; in this case I am playing with the original sequence number, but it could be a data-id or some unique code that can be used behind the scenes.link Click to view a demo
square
Comments
New Comment