HOw to find sum for datatable using json as source.am getting all the values but It gives no result
HOw to find sum for datatable using json as source.am getting all the values but It gives no result
srinivaasan
Posts: 2Questions: 1Answers: 0
jasoldata = <?php echo $result; ?>
$( document ).ready(function() {
var otable = $('#empTable').dataTable({
aaData: jasoldata,
aoColumns: [
{mData: "month"},
{mData: "services"},
{mData: "revenue"}
]
});
$("#test01").val(otable.column(3).Data().sum());
});
HTML
month | services | revenue |
---|---|---|
month | services | revenue |
<input type="textbox" name="outputv" id ="test01"></input>
This discussion has been closed.
Answers
Hi,
What do you mean by : " how-to-find-sum-for-datatable"
Do you want the amount of rows displayed ?
i want to find a sum for a column.
tickets = <?php echo $result5; ?> $( document ).ready(function() { var tablex = $('#complaint').dataTable({ aaData: tickets, aoColumns: [ {mData: "clientid"}, {mData: "total complaints"}, {mData: "open complaints"}, {mData: "closed complaints"} ] }); $('#button1').click( function () { alert( 'Column 4 total: ' +tablex.column(1).data().sum()); } ); });