Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js |
— | — | @@ -292,7 +292,21 @@ |
293 | 293 | } |
294 | 294 | ); |
295 | 295 | |
| 296 | +var planetsRowspan =[["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus]; |
296 | 297 | |
| 298 | +tableTest( |
| 299 | + 'Basic planet table: Same value for multiple rows via rowspan', |
| 300 | + header, |
| 301 | + planets, |
| 302 | + planetsRowspan, |
| 303 | + function( $table ) { |
| 304 | + //Quick&Dirty mod |
| 305 | + $table.find('tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)').remove(); |
| 306 | + $table.find('tr:eq(2) td:eq(1)').attr('rowspan', '3'); |
| 307 | + $table.tablesorter(); |
| 308 | + $table.find('.headerSort:eq(0)').click(); |
| 309 | + } |
| 310 | +); |
297 | 311 | |
298 | 312 | |
299 | 313 | |
Index: trunk/phase3/resources/jquery/jquery.tablesorter.js |
— | — | @@ -463,7 +463,14 @@ |
464 | 464 | var cell = $( this ); |
465 | 465 | var next = cell.parent().nextAll(); |
466 | 466 | for ( var i = 0; i < rowSpan - 1; i++ ) { |
467 | | - next.eq(0).find( 'td' ).eq( this.cellIndex ).before( cell.clone() ); |
| 467 | + var td = next.eq( i ).find( 'td' ); |
| 468 | + if ( !td.length ) { |
| 469 | + next.eq( i ).append( cell.clone() ); |
| 470 | + } else if ( this.cellIndex == 0 ) { |
| 471 | + td.eq( this.cellIndex ).before( cell.clone() ); |
| 472 | + } else { |
| 473 | + td.eq( this.cellIndex - 1 ).after( cell.clone() ); |
| 474 | + } |
468 | 475 | } |
469 | 476 | }); |
470 | 477 | } |