
Код: Выделить всё
function calculateColumn(index) {
var total = 0;
$('table tr').each(function() {
var value = parseFloat(($('td', this).eq(index).text()).replace(/,/g, ""));
if (!isNaN(value)) {
total += value;
}
});
$('table tfoot td').eq(index).text('Sum: ' + total);
}
$(document).ready(function() {
var table = $('#example').DataTable({
lengthChange: false,
buttons: ['copy', 'excel', 'pdf'],
paging: false,
scrollY: 400
});
table.buttons().container()
.appendTo('#example_wrapper .col-md-6:eq(0)');
$('#example').on('draw.dt', function() {
$('table thead th').each(function(i) {
calculateColumn(i);
});
});
$('table thead th').each(function(i) {
calculateColumn(i);
});
});Код: Выделить всё
15
Test Account (1420240741161)
-800
-610.73
16
Testing Account (1620240781182)
100
40
Sum:
Sum:
Повторяющийся текст не позволяет публиковать сообщения :
Сумма суммы не отображается в нижнем колонтитуле, создается дополнительная строка и отображается там сумма. Там, где это должно быть показано в нижнем колонтитуле.

Подробнее здесь: https://stackoverflow.com/questions/790 ... the-amount
Мобильная версия