ColumnSelector: check visibility of cells after colspan. See #1238

This commit is contained in:
Rob Garrison 2016-06-29 20:19:20 -05:00
parent aec698e22c
commit b48e3e3e09
No known key found for this signature in database
GPG Key ID: 0A42D160D71978E1
3 changed files with 19 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -567,7 +567,7 @@ $.tablesorter.columnSelector.refreshColumns( config, optionName, optionState );<
<!-- Remove column from selection popup by including -->
<!-- data-priority="Anything other than 1-6" OR data-column-selector="disable" OR class="columnSelector-disable" -->
<th class="columnSelector-disable">Major</th>
<!-- columnSelector-false will initially hide the column -->
<!-- columnSelector-false will initially hide the column; see columnSelector_mediaqueryHidden option -->
<th class="columnSelector-false" data-priority="6" data-selector-name="Gender">Sex</th>
<th data-priority="4">English</th>
<th data-priority="5">Japanese</th>

View File

@ -348,7 +348,7 @@
}
// only add resize end if using media queries
if ( hasSpans && wo.columnSelector_mediaquery ) {
nspace = c.namespace.slice( 1 ) + 'columnselector';
nspace = c.namespace + 'columnselector';
// Setup window.resizeEnd event
$window
.off( nspace )
@ -365,15 +365,18 @@
adjustColspans: function(c, wo) {
var index, cols, col, span, end, $cell,
colSel = c.selector,
autoModeOn = colSel.auto,
$colspans = $( c.namespace + 'columnselectorHasSpan' ),
len = $colspans.length;
if ( len ) {
for ( index = 0; index < len; index++ ) {
$cell = $colspans.eq(index);
col = parseInt( $cell.attr('data-column'), 10 ) || $cell[0].cellIndex;
span = parseInt( $cell.attr('data-col-span'), 10 );
end = col + span;
filtered = wo.filter_filteredRow || 'filtered',
autoModeOn = wo.columnSelector_mediaquery && colSel.auto,
// find all header/footer cells in case a regular column follows a colspan; see #1238
$headers = c.$table.children( 'thead, tfoot' ).children().children()
.add( $(c.namespace + '_extra_table').children( 'thead, tfoot' ).children().children() ),
len = $headers.length;
for ( index = 0; index < len; index++ ) {
$cell = $headers.eq(index);
col = parseInt( $cell.attr('data-column'), 10 ) || $cell[0].cellIndex;
span = parseInt( $cell.attr('data-col-span'), 10 ) || 1;
end = col + span;
if ( span > 1 ) {
for ( cols = col; cols < end; cols++ ) {
if ( !autoModeOn && colSel.states[ cols ] === false ||
autoModeOn && c.$headerIndexed[ cols ] && !c.$headerIndexed[ cols ].is(':visible') ) {
@ -381,10 +384,12 @@
}
}
if ( span ) {
$cell.removeClass( wo.filter_filteredRow || 'filtered' )[0].colSpan = span;
$cell.removeClass( filtered )[0].colSpan = span;
} else {
$cell.addClass( wo.filter_filteredRow || 'filtered' );
$cell.addClass( filtered );
}
} else if ( typeof colSel.states[ col ] !== 'undefined' ) {
$cell.toggleClass( filtered, !colSel.states[ col ] );
}
}
},