DataTables / Responsive

Responsive extension for DataTables, providing support for complex tables on all device screen sizes
Other
148 stars 86 forks source link

Column Detail Type Issue #63

Closed djuba closed 8 years ago

djuba commented 8 years ago

http://jsfiddle.net/uonhekd8/3/

Bootstrap 3.3.5, DataTables 1.10.10, FixedHeader 3.1.0, Responsive 2.0.0

See above jsFiddle. If you have a DataTable with column detail type, if the window is large enough so that there are no collapsed columns it will still show an empty child row when you click on a row.

I believe the issue is that the control column is used to determine whether to apply the "collapsed" class to the table in Responsive._resize(). I do not see any reason you would want to include the control column in that determination. I believe the Responsive._resize() code should be replaced by:

var collapsedClass = false;
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
    var isControlColumn = $(dt.column(i).header()).hasClass('control');
    if ( columnsVis[i] === false && ! columns[i].never && ! isControlColumn ) {
        collapsedClass = true;
        break;
    }
}

Keep up the good work!

DataTables commented 8 years ago

Agreed on all accounts (although I've changed the logic to detect the control column slightly to use the information in the columns object).

Thanks for flagging this up and the analysis!

djuba commented 8 years ago

Ah, yes, didn't realize that was part of the columns object! Thanks for the update!