mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-01 02:54:15 +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:
parent
7a171b14c2
commit
c20681668a
@ -1 +1 @@
|
|||||||
a5ec3278bb4c799d750ce6301268be88a300e9b9
|
d2937aa4bf198fc04533c0ed9e48dabeed4b967f
|
||||||
|
@ -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 {
|
table.dataTable.order-column.hover tbody tr.even:hover.selected > .sorting_3 {
|
||||||
background-color: #a4b2cb;
|
background-color: #a4b2cb;
|
||||||
}
|
}
|
||||||
|
table.dataTable.no-footer {
|
||||||
|
border-bottom: 1px solid #111111;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
table.dataTable,
|
table.dataTable,
|
||||||
table.dataTable th,
|
table.dataTable th,
|
||||||
|
18
media/js/jquery.dataTables.js
vendored
18
media/js/jquery.dataTables.js
vendored
@ -1602,7 +1602,7 @@
|
|||||||
if ( tfoot !== null ) {
|
if ( tfoot !== null ) {
|
||||||
var cells = oSettings.aoFooter[0];
|
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 = columns[i];
|
||||||
column.nTf = cells[i].cell;
|
column.nTf = cells[i].cell;
|
||||||
|
|
||||||
@ -6147,16 +6147,14 @@
|
|||||||
var thead = $(this).children('thead');
|
var thead = $(this).children('thead');
|
||||||
if ( thead.length === 0 )
|
if ( thead.length === 0 )
|
||||||
{
|
{
|
||||||
thead = [ document.createElement( 'thead' ) ];
|
thead = $('<thead/>').appendTo(this);
|
||||||
this.appendChild( thead[0] );
|
|
||||||
}
|
}
|
||||||
oSettings.nTHead = thead[0];
|
oSettings.nTHead = thead[0];
|
||||||
|
|
||||||
var tbody = $(this).children('tbody');
|
var tbody = $(this).children('tbody');
|
||||||
if ( tbody.length === 0 )
|
if ( tbody.length === 0 )
|
||||||
{
|
{
|
||||||
tbody = [ document.createElement( 'tbody' ) ];
|
tbody = $('<tbody/>').appendTo(this);
|
||||||
this.appendChild( tbody[0] );
|
|
||||||
}
|
}
|
||||||
oSettings.nTBody = tbody[0];
|
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
|
// 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
|
// a tfoot element for the caption element to be appended to
|
||||||
tfoot = [ document.createElement( 'tfoot' ) ];
|
tfoot = $('<tfoot/>').appendTo(this);
|
||||||
this.appendChild( tfoot[0] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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];
|
oSettings.nTFoot = tfoot[0];
|
||||||
_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
|
_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
|
||||||
}
|
}
|
||||||
@ -13281,6 +13280,7 @@
|
|||||||
|
|
||||||
$.extend( DataTable.ext.classes, {
|
$.extend( DataTable.ext.classes, {
|
||||||
"sTable": "dataTable",
|
"sTable": "dataTable",
|
||||||
|
"sNoFooter": "no-footer",
|
||||||
|
|
||||||
/* Paging buttons */
|
/* Paging buttons */
|
||||||
"sPageButton": "paginate_button",
|
"sPageButton": "paginate_button",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user