Language: JavaScript
Table Drag and Drop JQuery plugin - TableDnD plugin used for jqGrid
1: $(document).ready(function() { 2: 3: // Initialise the first table (as before) 4: $("#table-1").tableDnD(); 5: 6: // Make a nice striped effect on the table 7: $("#table-2 tr:even').addClass('alt')"); 8: 9: // Initialise the second table specifying a dragClass and an onDrop function that will display an alert 10: $("#table-2").tableDnD({ 11: onDragClass: "myDragClass", 12: onDrop: function(table, row) { 13: var rows = table.tBodies[0].rows; 14: var debugStr = "Row dropped was "+row.id+". New order: "; 15: for (var i=0; i<rows.length; i++) { 16: debugStr += rows[i].id+" "; 17: } 18: $(#debugArea).html(debugStr); 19: }, 20: onDragStart: function(table, row) { 21: $(#debugArea).html("Started dragging row "+row.id); 22: } 23: }); 24: });
Tags:
Description:
http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

