From: Leo Koppelkamm Date: Thu, 30 Jun 2011 19:40:19 +0000 (+0000) Subject: r86088: Adding legacy support for .sortbottom & a test for it per CR X-Git-Tag: 1.31.0-rc.0~29146 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=05135e2303e580f95a5e1b124234789db5e3f7dc;p=lhc%2Fweb%2Fwiklou.git r86088: Adding legacy support for .sortbottom & a test for it per CR --- diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index 6abdfc052d..14c6b0a3c8 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -539,6 +539,13 @@ if ( firstTime ) { firstTime = false; + + // Legacy fix of .sortbottoms + // Wrap them inside inside a tfoot (because that's what they actually want to be) & + // Move them up one level in the DOM + var sortbottoms = $table.find('tr.sortbottom').wrap(''); + sortbottoms.parents('table').append(sortbottoms.parent()); + explodeRowspans( $table ); // try to auto detect column type, and store in tables config table.config.parsers = buildParserCache( table, $headers ); diff --git a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js index 26e963d225..de9098a63e 100644 --- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js @@ -352,4 +352,20 @@ tableTest( } ); +ascendingNameLegacy = ascendingName.slice(0); +ascendingNameLegacy[4] = ascendingNameLegacy[5]; +ascendingNameLegacy.pop(); + +tableTest( + 'Legacy compat with .sortbottom', + header, + planets, + ascendingNameLegacy, + function( $table ) { + $table.find('tr:last').addClass('sortbottom'); + $table.tablesorter(); + $table.find('.headerSort:eq(0)').click(); + } +); + })();