1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-20 18:54:15 +01:00

New: Cached footer cells can now have colspan properties, allowing

column index referencing of the cells.

- Previously a colspan in a footer cell would cause index misalignment -
  for example if you had a table of 6 columns with two in the footer
  (one colspan=5) the fotoer cells would be assigned to the first two
  columns in the table, breaking column index order. Now a cell can be
  used over multiple columns. This allows column().footer() to always
  reflect the cell that belongs to that column (possibly sharing it with
  other columns).

- Note that the footer will only use cells from the first row in the
  footer. If there is more than one row, use table().foot() to access
  the TFoot element and then manipulate it as needed.
This commit is contained in:
Allan Jardine 2013-11-12 19:18:06 +00:00
parent ad973fec36
commit 8c2c65c9dd
2 changed files with 9 additions and 9 deletions

View File

@ -1 +1 @@
7a5f2b1397221a7c3e889f45cb4946cff217c5b4
8fa5b8aa7a24d4cc087a89f821095ad1756309da

View File

@ -1544,19 +1544,19 @@
$(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH );
$(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH );
/* Cache the footer elements */
// Cache the footer cells. Note that we only take the cells from the first
// row in the footer. If there is more than one row the user wants to
// interact with, they need to use the table().foot() method. Note also this
// allows cells to be used for multiple columns using colspan
if ( tfoot !== null ) {
var anCells = _fnGetUniqueThs( oSettings, null, oSettings.aoFooter );
var cells = oSettings.aoFooter[0];
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
column = columns[i];
column.nTf = cells[i].cell;
if ( anCells[i] ) {
column.nTf = anCells[i];
if ( column.sClass ) {
$(anCells[i]).addClass( column.sClass );
}
if ( column.sClass ) {
$(column.nTf).addClass( column.sClass );
}
}
}