I need a jQuery plugin that will take an HTML table, and will allow the replacement of cells in between each other, via drag n drop. Example:
[1][2][3]
[4][5][6]
[7][8][9]
When I drag 1 onto 9, it should replace them like so:
[9][2][3]
[4][5][6]
[7][8][1]
ideally with an optional callback function (to update a remote page with ajax开发者_开发问答).
Thanks in advance.
Look at this: http://www.redips.net/javascript/drag-and-drop-table-content/
Check the "Switch content option" below the table.
If not a plugin, then at least how to get to it and even try to write it myself.
Using jQuery UI you can create draggable elements. You can also create droppable elements.
Try messing around with those demos using a table and table cells and see how far you can get by yourself. If you hit a dead-end, come back and someone may be able to help you out once you have some code!
I've got it! http://jsfiddle.net/8dRZz/
In this example, it will stay "loading" forever, easily understandable since the handler in not there, so no AJAX success call.
精彩评论