jquery.dragtable.js
function() {
      var i, j, col1, col2;
      var from = this.originalTable.startIndex;
      var to = this.originalTable.endIndex;
      /* Find children thead and tbody.
       * Only to process the immediate tr-children. Bugfix for inner tables
       */
      var thtb = this.originalTable.el.children();
      if (this.options.excludeFooter) {
        thtb = thtb.not('tfoot');
      }
      if (from < to) {
        for (i = from; i < to; i++) {
          col1 = thtb.find('> tr > td:nth-child(' + i + ')')
            .add(thtb.find('> tr > th:nth-child(' + i + ')'));
          col2 = thtb.find('> tr > td:nth-child(' + (i + 1) + ')')
            .add(thtb.find('> tr > th:nth-child(' + (i + 1) + ')'));
          for (j = 0; j < col1.length; j++) {
            swapNodes(col1[j], col2[j]);
          }
        }
      } else {
        for (i = from; i > to; i--) {
          col1 = thtb.find('> tr > td:nth-child(' + i + ')')
            .add(thtb.find('> tr > th:nth-child(' + i + ')'));
          col2 = thtb.find('> tr > td:nth-child(' + (i - 1) + ')')
            .add(thtb.find('> tr > th:nth-child(' + (i - 1) + ')'));
          for (j = 0; j < col1.length; j++) {
            swapNodes(col1[j], col2[j]);
          }
        }
      }
    }
function() {
      var i, j, col1, col2;
      var from = this.originalTable.startIndex;
      var to = this.originalTable.endIndex;
      /* Find children thead and tbody.
       * Only to process the immediate tr-children. Bugfix for inner tables
       */
      var thtb = this.originalTable.el.children();
      if (this.options.excludeFooter) {
        thtb = thtb.not('tfoot');
      }
      if (from < to) {
        for (i = from; i < to; i++) {
          col1 = thtb.find('> tr > td:nth-child(' + i + ')')
            .add(thtb.find('> tr > th:nth-child(' + i + ')'));
          col2 = thtb.find('> tr > td:nth-child(' + (i + 1) + ')')
            .add(thtb.find('> tr > th:nth-child(' + (i + 1) + ')'));
          for (j = 0; j < col1.length; j++) {
            swapNodes(col1[j], col2[j]);
          }
        }
      } else {
        for (i = from; i > to; i--) {
          col1 = thtb.find('> tr > td:nth-child(' + i + ')')
            .add(thtb.find('> tr > th:nth-child(' + i + ')'));
          col2 = thtb.find('> tr > td:nth-child(' + (i - 1) + ')')
            .add(thtb.find('> tr > th:nth-child(' + (i - 1) + ')'));
          for (j = 0; j < col1.length; j++) {
            swapNodes(col1[j], col2[j]);
          }
        }
      }
    }
function ( ) { var i , j , col1 , col2 ; var from = this . originalTable . startIndex ; var to = this . originalTable . endIndex ; /* Find children thead and tbody.
       * Only to process the immediate tr-children. Bugfix for inner tables
       */ var thtb = this . originalTable . el . children ( ) ; if ( this . options . excludeFooter ) { thtb = thtb . not ( 'tfoot' ) ; } if ( from < to ) { for ( i = from ; i < to ; i ++ ) { col1 = thtb . find ( '> tr > td:nth-child(' + i + ')' ) . add ( thtb . find ( '> tr > th:nth-child(' + i + ')' ) ) ; col2 = thtb . find ( '> tr > td:nth-child(' + ( i + 1 ) + ')' ) . add ( thtb . find ( '> tr > th:nth-child(' + ( i + 1 ) + ')' ) ) ; for ( j = 0 ; j < col1 . length ; j ++ ) { swapNodes ( col1 [ j ] , col2 [ j ] ) ; } } } else { for ( i = from ; i > to ; i -- ) { col1 = thtb . find ( '> tr > td:nth-child(' + i + ')' ) . add ( thtb . find ( '> tr > th:nth-child(' + i + ')' ) ) ; col2 = thtb . find ( '> tr > td:nth-child(' + ( i - 1 ) + ')' ) . add ( thtb . find ( '> tr > th:nth-child(' + ( i - 1 ) + ')' ) ) ; for ( j = 0 ; j < col1 . length ; j ++ ) { swapNodes ( col1 [ j ] , col2 [ j ] ) ; } } } }
bubble the moved col left or right
bubble the moved col left or right