mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Core: Fix parser detect of columns that don't exist due to colspan
And prevent error if config.sortVars is undefined See #746 & #1047
This commit is contained in:
parent
94c2ce700a
commit
63374355ca
@ -577,6 +577,10 @@
|
||||
// cache headers per column
|
||||
c.$headerIndexed = [];
|
||||
for ( indx = 0; indx < c.columns; indx++ ) {
|
||||
// colspan in header making a column undefined
|
||||
if ( ts.isEmptyObject( c.sortVars[ indx ] ) ) {
|
||||
c.sortVars[ indx ] = {};
|
||||
}
|
||||
$temp = c.$headers.filter( '[data-column="' + indx + '"]' );
|
||||
// target sortable column cells, unless there are none, then use non-sortable cells
|
||||
// .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
|
||||
@ -661,7 +665,7 @@
|
||||
extractor = false;
|
||||
}
|
||||
if ( !parser ) {
|
||||
parser = ts.detectParserForColumn( c, rows, -1, indx );
|
||||
parser = ts.detectParserForColumn( c, rows, -1, colIndex );
|
||||
}
|
||||
if ( c.debug ) {
|
||||
debug[ '(' + colIndex + ') ' + header.text() ] = {
|
||||
@ -890,13 +894,11 @@
|
||||
max = c.columns;
|
||||
for ( colIndex = 0; colIndex < max; ++colIndex ) {
|
||||
cell = $row[ 0 ].cells[ colIndex ];
|
||||
if ( cell ) {
|
||||
if ( typeof parsers[ cacheIndex ] === 'undefined' ) {
|
||||
if ( c.debug ) {
|
||||
console.warn( 'No parser found for cell:', cell, 'does it have a header?' );
|
||||
}
|
||||
continue;
|
||||
if ( typeof parsers[ cacheIndex ] === 'undefined' ) {
|
||||
if ( c.debug ) {
|
||||
console.warn( 'No parser found for column ' + colIndex + '; cell:', cell, 'does it have a header?' );
|
||||
}
|
||||
} else if ( cell ) {
|
||||
val = ts.getElementText( c, cell, cacheIndex );
|
||||
rowData.raw[ cacheIndex ] = val; // save original row text
|
||||
txt = ts.getParsedText( c, cell, cacheIndex, val );
|
||||
|
Loading…
Reference in New Issue
Block a user