Skip to content

Commit

Permalink
Fix: Update how the number of hidden elements are calculated to use t…
Browse files Browse the repository at this point in the history
…he attribute value from DataTables rather than calculating the value with jQuery
  • Loading branch information
Allan Jardine committed Sep 24, 2014
1 parent 53aae97 commit cea1178
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions js/dataTables.responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,17 @@ Responsive.prototype = {
var that = this;
var dt = this.s.dt;

var hiddenColumns = dt.columns(':hidden').indexes().flatten();
// Find how many columns are hidden
var hiddenColumns = dt.columns().indexes().filter( function ( idx ) {
var col = dt.column( idx );

if ( col.visible() ) {
return null;
}

// Only counts as hidden if it doesn't have the `never` class
return $( col.header() ).hasClass( 'never' ) ? null : idx;
} );
var haveHidden = true;

if ( hiddenColumns.length === 0 || ( hiddenColumns.length === 1 && this.s.columns[ hiddenColumns[0] ].control ) ) {
Expand Down Expand Up @@ -662,7 +672,6 @@ Responsive.defaults = {
var header = $( api.column( cell.column ).header() );
var idx = api.cell( cell ).index();

console.log( header[0].className );
if ( header.hasClass( 'control' ) || header.hasClass( 'never' ) ) {
return '';
}
Expand Down

0 comments on commit cea1178

Please sign in to comment.