i want sum of column in footer
i want sum of column in footer
```
Sno. | OIC Name | Case disposal statistics | (Pending+Interim) cases in various court | (Pending+Interim) cases case type wise | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Total | Disposed | Interim | Pending | SC | HC | DC | TC | Land Related | Service Matter | Others | ||
GRAND TOTAL | ||||||||||||
2 | peon | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
3 | dsfdfd | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4 | steno | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
<
script type="text/javascript">
$(document).ready(function() {
$('#ghatable1').dataTable({
responsive: true
});
var table = $('#ghatable1').DataTable();
var iColumns = $('#ghatable1 tfoot th').length;
//alert(iColumns);
for ( var i=2 ; i<iColumns ; i++ )
{
var column = table.column(i);
$(column.footer()).html(
column.data().reduce(function (a, b) {
return parseInt(a, 10) + parseInt(b, 10);
})
);
}
</script>```
the problem is that when I put between <td></td> tag hyperlink <a></a> the grand total in footer using above datatable java script stop working.
kindly suggest the solution when I put hyperlink between <td></td> tags
thanks in advance to all of u to support
Answers
You have to have a smarter method to get the values out of the inner nodes than just parseInt. You need a function that will pull the inner text out of the content.
replace your parseInt with floatVal
This function might work for you, it does for me. If the cell contains a number, it returns that, if it's a string, it strips out $ and commas, if that fails it then pulls the inner text. You can modify it to handle your numerical situations.