Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions js/dataTables.rowGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,20 @@ $.extend( RowGroup.prototype, {
*/
_adjustColspan: function ()
{
$( 'tr.'+this.c.className, this.s.dt.table().body() ).find('td:visible')
.attr( 'colspan', this._colspan() );
var dt = this.s.dt;

$( 'tr.'+this.c.className, this.s.dt.table().body() ).each( function ( undefined, tr ) {
var tds = $(tr).children();
if ( tds.length === 1 ){
tds.attr( 'colspan', this._colspan());
}
else if ( tds.length > 1 ){
tds.each( function ( i, td ) {
$(td).css('display', $(dt.column(i).header()).css('display'));//mimic the display val of the header
});
}
});

},

/**
Expand Down Expand Up @@ -320,6 +332,7 @@ $.extend( RowGroup.prototype, {
_rowWrap: function ( display, className, level )
{
var row;
var dt = this.s.dt;

if ( display === null || display === '' ) {
display = this.c.emptyDataGroup;
Expand All @@ -336,14 +349,33 @@ $.extend( RowGroup.prototype, {
row = display;
}
else {

row = $('<tr/>')
.append(
$('<td/>')
.attr( 'colspan', this._colspan() )
.append( display )
);

var displayTr = row.find('> td > tr');

if ( displayTr.length ){
row = $(displayTr[0]);
}

}

var tds = $(row).children();
if ( tds.length === 1 ){
tds.attr( 'colspan', this._colspan());
}
else if ( tds.length > 1 ){
tds.each( function ( i, td ) {
$(td).css('display', $(dt.column(i).header()).css('display'));//mimic the display val of the header
});
}


return row
.addClass( this.c.className )
.addClass( className )
Expand Down