Core: Allow passing headers from multiple rows. See #1116

This commit is contained in:
Rob Garrison 2018-04-11 19:36:41 -05:00
parent 2983454fda
commit 200fcacb3b

View File

@ -518,11 +518,8 @@
ts.buildCache( c ); ts.buildCache( c );
} }
$cell = ts.getClosest( $( this ), '.' + ts.css.header ); $cell = ts.getClosest( $( this ), '.' + ts.css.header );
// reference original table headers and find the same cell // use column index from data-attribute or index of current row; fixes #1116
// don't use $headers or IE8 throws an error - see #987 c.last.clickedIndex = $cell.attr( 'data-column' ) || $cell.index();
temp = $headers.index( $cell );
c.last.clickedIndex = ( temp < 0 ) ? $cell.attr( 'data-column' ) : temp;
// use column index if $headers is undefined
cell = c.$headers[ c.last.clickedIndex ]; cell = c.$headers[ c.last.clickedIndex ];
if ( cell && !cell.sortDisabled ) { if ( cell && !cell.sortDisabled ) {
ts.initSort( c, cell, e ); ts.initSort( c, cell, e );