template/html/jquery-tablesorter.js
function( $rows, c ) {
         var i, j, k, l, cell, cells, rowIndex, rowSpan, colSpan, firstAvailCol,
         // total columns has been calculated, use it to set the matrixrow
          columns = c && c.columns || 0,
          matrix = [],
          matrixrow = new Array( columns );
         for ( i = 0; i < $rows.length; i++ ) {
            cells = $rows[ i ].cells;
            for ( j = 0; j < cells.length; j++ ) {
               cell = cells[ j ];
               rowIndex = cell.parentNode.rowIndex;
               rowSpan = cell.rowSpan || 1;
               colSpan = cell.colSpan || 1;
               if ( typeof matrix[ rowIndex ] === 'undefined' ) {
                  matrix[ rowIndex ] = [];
               }
               // Find first available column in the first row
               for ( k = 0; k < matrix[ rowIndex ].length + 1; k++ ) {
                  if ( typeof matrix[ rowIndex ][ k ] === 'undefined' ) {
                     firstAvailCol = k;
                     break;
                  }
               }
               // jscs:disable disallowEmptyBlocks
               if ( columns && cell.cellIndex === firstAvailCol ) {
                  // don't to anything
               } else if ( cell.setAttribute ) {
                  // jscs:enable disallowEmptyBlocks
                  // add data-column (setAttribute = IE8+)
                  cell.setAttribute( 'data-column', firstAvailCol );
               } else {
                  // remove once we drop support for IE7 - 1/12/2016
                  $( cell ).attr( 'data-column', firstAvailCol );
               }
               for ( k = rowIndex; k < rowIndex + rowSpan; k++ ) {
                  if ( typeof matrix[ k ] === 'undefined' ) {
                     matrix[ k ] = [];
                  }
                  matrixrow = matrix[ k ];
                  for ( l = firstAvailCol; l < firstAvailCol + colSpan; l++ ) {
                     matrixrow[ l ] = 'x';
                  }
               }
            }
         }
         return matrixrow.length;
      }
function( $rows, c ) {
         var i, j, k, l, cell, cells, rowIndex, rowSpan, colSpan, firstAvailCol,
         // total columns has been calculated, use it to set the matrixrow
          columns = c && c.columns || 0,
          matrix = [],
          matrixrow = new Array( columns );
         for ( i = 0; i < $rows.length; i++ ) {
            cells = $rows[ i ].cells;
            for ( j = 0; j < cells.length; j++ ) {
               cell = cells[ j ];
               rowIndex = cell.parentNode.rowIndex;
               rowSpan = cell.rowSpan || 1;
               colSpan = cell.colSpan || 1;
               if ( typeof matrix[ rowIndex ] === 'undefined' ) {
                  matrix[ rowIndex ] = [];
               }
               // Find first available column in the first row
               for ( k = 0; k < matrix[ rowIndex ].length + 1; k++ ) {
                  if ( typeof matrix[ rowIndex ][ k ] === 'undefined' ) {
                     firstAvailCol = k;
                     break;
                  }
               }
               // jscs:disable disallowEmptyBlocks
               if ( columns && cell.cellIndex === firstAvailCol ) {
                  // don't to anything
               } else if ( cell.setAttribute ) {
                  // jscs:enable disallowEmptyBlocks
                  // add data-column (setAttribute = IE8+)
                  cell.setAttribute( 'data-column', firstAvailCol );
               } else {
                  // remove once we drop support for IE7 - 1/12/2016
                  $( cell ).attr( 'data-column', firstAvailCol );
               }
               for ( k = rowIndex; k < rowIndex + rowSpan; k++ ) {
                  if ( typeof matrix[ k ] === 'undefined' ) {
                     matrix[ k ] = [];
                  }
                  matrixrow = matrix[ k ];
                  for ( l = firstAvailCol; l < firstAvailCol + colSpan; l++ ) {
                     matrixrow[ l ] = 'x';
                  }
               }
            }
         }
         return matrixrow.length;
      }
function ( $rows , c ) { var i , j , k , l , cell , cells , rowIndex , rowSpan , colSpan , firstAvailCol , // total columns has been calculated, use it to set the matrixrow columns = c && c . columns || 0 , matrix = [ ] , matrixrow = new Array ( columns ) ; for ( i = 0 ; i < $rows . length ; i ++ ) { cells = $rows [ i ] . cells ; for ( j = 0 ; j < cells . length ; j ++ ) { cell = cells [ j ] ; rowIndex = cell . parentNode . rowIndex ; rowSpan = cell . rowSpan || 1 ; colSpan = cell . colSpan || 1 ; if ( typeof matrix [ rowIndex ] === 'undefined' ) { matrix [ rowIndex ] = [ ] ; } // Find first available column in the first row for ( k = 0 ; k < matrix [ rowIndex ] . length + 1 ; k ++ ) { if ( typeof matrix [ rowIndex ] [ k ] === 'undefined' ) { firstAvailCol = k ; break ; } } // jscs:disable disallowEmptyBlocks if ( columns && cell . cellIndex === firstAvailCol ) { // don't to anything } else if ( cell . setAttribute ) { // jscs:enable disallowEmptyBlocks // add data-column (setAttribute = IE8+) cell . setAttribute ( 'data-column' , firstAvailCol ) ; } else { // remove once we drop support for IE7 - 1/12/2016 $ ( cell ) . attr ( 'data-column' , firstAvailCol ) ; } for ( k = rowIndex ; k < rowIndex + rowSpan ; k ++ ) { if ( typeof matrix [ k ] === 'undefined' ) { matrix [ k ] = [ ] ; } matrixrow = matrix [ k ] ; for ( l = firstAvailCol ; l < firstAvailCol + colSpan ; l ++ ) { matrixrow [ l ] = 'x' ; } } } } return matrixrow . length ; }
computeTableHeaderCellIndexes from: http://www.javascripttoolbox.com/lib/table/examples.php http://www.javascripttoolbox.com/temp/table_cellindex.html
computeTableHeaderCellIndexes from : http : // www . javascripttoolbox . com / lib / table / examples . php http : // www . javascripttoolbox . com / temp / table_cellindex . html