JQuery-tableDnD 拖拽的基本使用 Table Drag and Drop JQuery plugin

时间:2022-10-01 01:21:55


 



D is a jQuery plugin that allows you to drag and drop rows within a table for reordering the table data.

Basic Usage:

1. Include jQuery library and TableDnD.js



<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/jquery.tablednd.0.7.min.js"></script>



 

2. Call the plugin



<script type="text/javascript">
$(document).ready(function() {
     
// Initialise the first table (as before)
$("#table-1").tableDnD();
 
   
});
</script>



 

3. Markup

<table  cellspacing="0" cellpadding="2">
    <tr ><td>1</td><td>One</td><td>some text</td></tr>
    <tr ><td>2</td><td>Two</td><td>some text</td></tr>
    <tr ><td>3</td><td>Three</td><td>some text</td></tr>
    <tr ><td>4</td><td>Four</td><td>some text</td></tr>
    <tr ><td>5</td><td>Five</td><td>some text</td></tr>
    <tr ><td>6</td><td>Six</td><td>some text</td></tr>
</table>

 

For more Advanced Usages, please check the demo page or visit the official website.