diff --git a/.datatables-commit-sync b/.datatables-commit-sync index cd39e722..47a0e0ec 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -319a8babbafdd3a87242271126086806252542c3 +d8c274637a604327bc05c32593b6199b4080e9b9 diff --git a/examples/advanced_init/footer_callback.html b/examples/advanced_init/footer_callback.html index da593ecd..3db8f03b 100644 --- a/examples/advanced_init/footer_callback.html +++ b/examples/advanced_init/footer_callback.html @@ -24,6 +24,7 @@ $(document).ready(function() { $('#example').dataTable( { "footerCallback": function ( row, data, start, end, display ) { var api = this.api(); + // Remove the formatting to get integer data for summation var intVal = function ( i ) { return typeof i === 'string' ? i.replace(/[\$,]/g, '')*1 : @@ -48,7 +49,7 @@ $(document).ready(function() { } ); // Update footer - $('th:eq(1)', row).html( + $( api.column( 4 ).footer() ).html( '$'+pageTotal +' ( $'+ total +' total)' ); } @@ -73,7 +74,11 @@ $(document).ready(function() { data manipulation functions, such as summarising data in the table.
The example below shows a footer callback being used to total the data for a column (both the - visible and the hidden data) using the `dt-api column().data() API method.
+ visible and the hidden data) using thecolumn().data()
API method and column().footer()
for writing the value into the footer.