From 200fcacb3bc1a09be3c953932275aa52c3bd7b2f Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Wed, 11 Apr 2018 19:36:41 -0500 Subject: [PATCH] Core: Allow passing headers from multiple rows. See #1116 --- js/jquery.tablesorter.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index c3243680..4b6b9f1a 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -518,11 +518,8 @@ ts.buildCache( c ); } $cell = ts.getClosest( $( this ), '.' + ts.css.header ); - // reference original table headers and find the same cell - // don't use $headers or IE8 throws an error - see #987 - temp = $headers.index( $cell ); - c.last.clickedIndex = ( temp < 0 ) ? $cell.attr( 'data-column' ) : temp; - // use column index if $headers is undefined + // use column index from data-attribute or index of current row; fixes #1116 + c.last.clickedIndex = $cell.attr( 'data-column' ) || $cell.index(); cell = c.$headers[ c.last.clickedIndex ]; if ( cell && !cell.sortDisabled ) { ts.initSort( c, cell, e );