1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-30 23:52:11 +01:00

New: no-footer class automatically added to the table when no tfoot

- It appears that ti is impossible to know in CSS if a table doesn't
  have a tfoot element reliably and cross browser, so I've added a class
  which is added to the table automatically if the table has no footer
  or the fotoer is empty to complete the styling of the table.

- Fixed error when there are no cells in an empty TR row in the footer.
This commit is contained in:
Allan Jardine 2013-12-10 17:54:53 +00:00
parent 7a171b14c2
commit c20681668a
3 changed files with 14 additions and 10 deletions

View File

@ -1 +1 @@
a5ec3278bb4c799d750ce6301268be88a300e9b9
d2937aa4bf198fc04533c0ed9e48dabeed4b967f

View File

@ -210,6 +210,10 @@ table.dataTable.order-column.hover tbody tr.odd:hover.selected > .sorting_3,
table.dataTable.order-column.hover tbody tr.even:hover.selected > .sorting_3 {
background-color: #a4b2cb;
}
table.dataTable.no-footer {
border-bottom: 1px solid #111111;
margin-bottom: 0.5em;
}
table.dataTable,
table.dataTable th,

View File

@ -1602,7 +1602,7 @@
if ( tfoot !== null ) {
var cells = oSettings.aoFooter[0];
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
for ( i=0, ien=cells.length ; i<ien ; i++ ) {
column = columns[i];
column.nTf = cells[i].cell;
@ -6147,16 +6147,14 @@
var thead = $(this).children('thead');
if ( thead.length === 0 )
{
thead = [ document.createElement( 'thead' ) ];
this.appendChild( thead[0] );
thead = $('<thead/>').appendTo(this);
}
oSettings.nTHead = thead[0];
var tbody = $(this).children('tbody');
if ( tbody.length === 0 )
{
tbody = [ document.createElement( 'tbody' ) ];
this.appendChild( tbody[0] );
tbody = $('<tbody/>').appendTo(this);
}
oSettings.nTBody = tbody[0];
@ -6165,12 +6163,13 @@
{
// If we are a scrolling table, and no footer has been given, then we need to create
// a tfoot element for the caption element to be appended to
tfoot = [ document.createElement( 'tfoot' ) ];
this.appendChild( tfoot[0] );
tfoot = $('<tfoot/>').appendTo(this);
}
if ( tfoot.length > 0 )
{
if ( tfoot.length === 0 || tfoot.children().length === 0 ) {
$(this).addClass( oSettings.oClasses.sNoFooter );
}
else if ( tfoot.length > 0 ) {
oSettings.nTFoot = tfoot[0];
_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
}
@ -13281,6 +13280,7 @@
$.extend( DataTable.ext.classes, {
"sTable": "dataTable",
"sNoFooter": "no-footer",
/* Paging buttons */
"sPageButton": "paginate_button",