how do I get each row date with multiple columns data
how do I get each row date with multiple columns data
Link to test case: http://live.datatables.net/surfing/8/edit
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
so I learned that such each function loop all rows in one column, like salary is column(5)
table
.column( 5 )
.data()
.each( function ( value, index ) {}
But how do I get multiple columns data in one row,
say , I want to get the age and salary at same time, so I can do some calculation on both variables f(age, salary)
for example, age<65 salary will not be added into total.
thank you.
Oh , I got it, never mind thank you.
$(document).ready( function () {
var table = $('#example').DataTable();
let total =0;
let n=0;
//$.each( table.$(':input'), function( index ) {
// alert( $(this).outerHTML );
//});
table
.data()
.each( function ( value , index ) {
total =total + parseFloat(value[5].replace(/\$|,/g, ''));
if (n<3){
alert(n+ 'total: '+index+' is: '+total + value[3]);
}
n +=1;
$('#fieldTotal').val(total);
$('#fieldrows').val(n);
} );
} );