Advertisement
Guest User

Untitled

a guest
May 11th, 2015
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.67 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.     <head>
  5.         <title>Data Tables test</title>
  6.  
  7.         <script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
  8.         <!--<script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>-->
  9.        
  10.         <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js" type="text/javascript"></script>
  11.         <link href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css"/>
  12.  
  13.         <script src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js" type="text/javascript"></script>
  14.        
  15.         <script src="https://cdn.datatables.net/plug-ins/1.10.7/integration/jqueryui/dataTables.jqueryui.js" type="text/javascript"></script>
  16.         <link href="https://cdn.datatables.net/plug-ins/1.10.7/integration/jqueryui/dataTables.jqueryui.css" rel="stylesheet" type="text/css"/>
  17.         <script src="http://jquery-datatables-row-reordering.googlecode.com/svn/trunk/media/js/jquery.dataTables.rowReordering.js" type="text/javascript"></script>
  18.        
  19.         <script type='text/javascript'>
  20.             $(function()
  21.             {
  22.                 $("#mySuperTable").dataTable(
  23.                 {
  24.                     // method below is needed to fix the error: "Error: Syntax error, unrecognized expression: #":
  25.                     // http://datatables.net/forums/discussion/19011/drag-and-drop-row-reordering-issue
  26.                     "fnRowCallback": function (nRow, aData, iDisplayIndex)
  27.                     {
  28.                         nRow.setAttribute('id', aData.RowOrder);  //Initialize row id for every row
  29.                     }
  30.                     ,"aaSorting" : [] // thought sorting was the problem, but it's not.
  31.                 }).rowReordering();
  32.             });
  33.         </script>
  34.        
  35.     </head>
  36.     <body>
  37.        
  38.         <table id="mySuperTable">
  39.             <thead>
  40.                 <tr>
  41.                     <th>Name</th>
  42.                     <th>Address</th>
  43.                 </tr>
  44.             </thead>
  45.             <tbody>
  46.                 <tr>
  47.                     <td>Mary Sue</td>
  48.                     <td>123 South st.</td>
  49.                 </tr>
  50.                 <tr>
  51.                     <td>Anthony Jones</td>
  52.                     <td>321 East st.</td>
  53.                 </tr>
  54.                 <tr>
  55.                     <td>Jamie Lanister</td>
  56.                     <td>98 King's Landing Ave.</td>
  57.                 </tr>
  58.                 <tr>
  59.                     <td>Donald Duck</td>
  60.                     <td>54 Disney Dr.</td>
  61.                 </tr>
  62.             </tbody>
  63.         </table>
  64.        
  65.     </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement