Footer not created in dom

Footer not created in dom

sronsieksronsiek Posts: 52Questions: 11Answers: 0

Hi,

I'm trying to create a table footer with totals, similar to the example shown here:

https://datatables.net/reference/api/columns().footer()

Minor comment: the example is missing a second arg of 0 to reduce()

Debugging shows the sum is correctly calculated, but insertion into the dom fails:

$( this.footer() ).html( 'Sum: '+sum );

because there is no tfoot tag (the first arg of footerCallback is also empty). Documentation of dom does not mention if a letter needs to be supplied to create a footer, and column.footer() and columns.footer() are only getters - ie cannot be used to create a footer row.

I have managed to make it work by manually inserting <tfoot></tfoot> tags into the html and injecting $('tfoot').html('<tr><td> ....') but this is surely not intended. I also need to 'manually' create the right number of cells ...

How should the footer be created?

PS fixedHeaders is in use, but set to false on the page in question.
DataTables 1.10.10.

Answers

This discussion has been closed.