Index: trunk/phase3/resources/jquery/jquery.tablesorter.js |
— | — | @@ -8,8 +8,9 @@ |
9 | 9 | * http://www.opensource.org/licenses/mit-license.php |
10 | 10 | * http://www.gnu.org/licenses/gpl.html |
11 | 11 | * |
12 | | - * @depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort, |
| 12 | + * Depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort, |
13 | 13 | * wgDefaultDateFormat, wgContentLanguage) |
| 14 | + * Uses 'tableSorterCollation' in mw.config (if available) |
14 | 15 | */ |
15 | 16 | /** |
16 | 17 | * |
— | — | @@ -222,7 +223,7 @@ |
223 | 224 | realCellIndex = 0, |
224 | 225 | $tableHeaders = $( 'thead:eq(0) tr', table ); |
225 | 226 | if ( $tableHeaders.length > 1 ) { |
226 | | - $tableHeaders.each(function() { |
| 227 | + $tableHeaders.each( function() { |
227 | 228 | if ( this.cells.length > maxSeen ) { |
228 | 229 | maxSeen = this.cells.length; |
229 | 230 | longest = this; |
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js |
— | — | @@ -286,15 +286,20 @@ |
287 | 287 | umlautWords, |
288 | 288 | umlautWordsSorted, |
289 | 289 | function( $table ) { |
290 | | - mw.config.set( 'tableSorterCollation', {'ä':'ae', 'ö' : 'oe', 'ß': 'ss', 'ü':'ue'}); |
| 290 | + mw.config.set( 'tableSorterCollation', { |
| 291 | + 'ä': 'ae', |
| 292 | + 'ö' : 'oe', |
| 293 | + 'ß': 'ss', |
| 294 | + 'ü':'ue' |
| 295 | + } ); |
291 | 296 | $table.tablesorter(); |
292 | 297 | $table.find( '.headerSort:eq(0)' ).click(); |
293 | 298 | mw.config.set( 'tableSorterCollation', {} ); |
294 | 299 | } |
295 | 300 | ); |
296 | 301 | |
297 | | -var planetsRowspan =[["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus]; |
298 | | -var planetsRowspanII =[jupiter, mercury, saturn, ['Venus', '6371.0'], venus, ['Venus', '3390.0']]; |
| 302 | +var planetsRowspan = [["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus]; |
| 303 | +var planetsRowspanII = [jupiter, mercury, saturn, ['Venus', '6371.0'], venus, ['Venus', '3390.0']]; |
299 | 304 | |
300 | 305 | tableTest( |
301 | 306 | 'Basic planet table: Same value for multiple rows via rowspan', |
— | — | @@ -302,9 +307,13 @@ |
303 | 308 | planets, |
304 | 309 | planetsRowspan, |
305 | 310 | function( $table ) { |
306 | | - //Quick&Dirty mod |
| 311 | + // Modify the table to have a multiuple-row-spanning cell: |
| 312 | + // - Remove 2nd cell of 4th row, and, 2nd cell or 5th row. |
307 | 313 | $table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove(); |
| 314 | + // - Set rowspan for 2nd cell of 3rd row to 3. |
| 315 | + // This covers the removed cell in the 4th and 5th row. |
308 | 316 | $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' ); |
| 317 | + |
309 | 318 | $table.tablesorter(); |
310 | 319 | $table.find( '.headerSort:eq(0)' ).click(); |
311 | 320 | } |
— | — | @@ -315,9 +324,13 @@ |
316 | 325 | planets, |
317 | 326 | planetsRowspanII, |
318 | 327 | function( $table ) { |
319 | | - //Quick&Dirty mod |
| 328 | + // Modify the table to have a multiuple-row-spanning cell: |
| 329 | + // - Remove 1st cell of 4th row, and, 1st cell or 5th row. |
320 | 330 | $table.find( 'tr:eq(3) td:eq(0), tr:eq(4) td:eq(0)' ).remove(); |
| 331 | + // - Set rowspan for 1st cell of 3rd row to 3. |
| 332 | + // This covers the removed cell in the 4th and 5th row. |
321 | 333 | $table.find( 'tr:eq(2) td:eq(0)' ).prop( 'rowspan', '3' ); |
| 334 | + |
322 | 335 | $table.tablesorter(); |
323 | 336 | $table.find( '.headerSort:eq(0)' ).click(); |
324 | 337 | } |