From b7e5b030837bd2fac3200838fd0ad8a915fdcddd Mon Sep 17 00:00:00 2001 From: Platonides Date: Mon, 3 May 2010 20:37:30 +0000 Subject: [PATCH] The previous code computing rowStart will fail when there are theads since tHead contents are also computed inside table.rows. However, that code probably worked at some time, so perform a computation to ensure that table.rows isn't getting just the tBody contents. Please cross browser test. The last code version of this sortables is on http://yoast.com/articles/sortable-table/ and has changed quite a bit. Joost de Valk suggest using the jQuery based tablesorter.com. --- skins/common/wikibits.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 6967b7ba20..0c16626108 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -618,7 +618,15 @@ function ts_resortTable( lnk ) { // Work out a type for the column // Skip the first row if that's where the headings are var rowStart = ( table.tHead && table.tHead.rows.length > 0 ? 0 : 1 ); - + var bodyRows = 0; + if (rowStart == 0 && table.tBodies) { + for (var i=0; i < table.tBodies.length; i++ ) { + bodyRows += table.tBodies[i].rows.length; + } + if (bodyRows < table.rows.length) + rowStart = 1; + } + var itm = ''; for ( var i = rowStart; i < table.rows.length; i++ ) { if ( table.rows[i].cells.length > column ) { -- 2.20.1