Your posted code sample confused me so I created a simpler version myself. This will give some idea on how to proceed.
Here is a JSFiddle of it.[
^]
If you have a table with two columns, like this:
<html>
<body>
<div class="container">
<table id="tabledata" class="display datatble table-hover" cellpadding="0" cellspacing="0" border="0" width="100%">
<thead id="tablehead">
<tr>
<th>ID</th>
<th>Count</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>10</td>
</tr>
<tr>
<td>1</td>
<td>15</td>
</tr>
<tr>
<td>1</td>
<td>20</td>
</tr>
<tr>
<td>2</td>
<td>10</td>
</tr>
</tbody>
<tfoot>
<tr></tr>
</tfoot>
</table>
</div>
<p id="total">
</p>
</body>
</html>
Then you can get the total using this jQuery code:
var i = 0;
$('#tabledata tbody tr').each(function() {
if ($(this).find("td:eq('0')").text() === '1') {
i = i + parseInt($(this).find("td:eq('1')").text());
}
});
$('#total').text(i);
Of course your scenario would be a bit more complicated than this. But I guess this will give some idea on how to proceed.