Summary footer row

Summary footer row

nkonko Posts: 4Questions: 0Answers: 0
edited August 2013 in General
Hi, in which way I can visualize a summary row for all my columns like the code above...
[code]
var oTable = $('#obj_tab').dataTable();
var nNodes = oTable.dataTable().fnGetNodes( );
//alert(nNodes);
var grandTotalRow = "TOTALE";
for(i=1;i<4;i++) // replace numCols with the number of columns in your table
{
var total=0;
var rows = $('#' + this.htmlObject + ' tbody tr');
rows.each(function()
{
//alert("entrato");
var cellVal = parseFloat($('td:eq('+i+')', this).text().replace(',',''));
if(!isNaN(cellVal))
{
total += cellVal;
}
});
grandTotalRow += ""+total.toLocaleString()+"";
}
grandTotalRow += "";
if($('#'+this.htmlObject+' tfoot').length==0)
$('#'+this.htmlObject).find('table').append(grandTotalRow);

$("#obj_tabCittadinanza_wrapper").css("min-height", "200px");
$("#obj_tabCittadinanza_wrapper").css("height", "200px");
}
};
[/code]

In detail how I can pass the columns like "var rows = $('#' + this.htmlObject + ' tbody tr');" in order to perform the for each function?

Thanks

Replies

This discussion has been closed.