r90657 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90656‎ | r90657 | r90658 >
Date:08:31, 23 June 2011
Author:diebuche
Status:ok
Tags:
Comment:
Adding rowspan tests to tablesorting & make it more stable
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.tablesorter.js (modified) (history)
  • /trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
@@ -292,7 +292,21 @@
293293 }
294294 );
295295
 296+var planetsRowspan =[["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus];
296297
 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+);
297311
298312
299313
Index: trunk/phase3/resources/jquery/jquery.tablesorter.js
@@ -463,7 +463,14 @@
464464 var cell = $( this );
465465 var next = cell.parent().nextAll();
466466 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+ }
468475 }
469476 });
470477 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r91782MFT to REL_1_18: jquery tablesorter...hashar08:54, 9 July 2011
r95424Add comments and fix whitespace for r90657, r86305krinkle19:35, 24 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86305Followup r86088 per CR: Move month array builder into language; use mw.config...diebuche12:54, 18 April 2011

Status & tagging log