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

srinivaasansrinivaasan Posts: 2Questions: 1Answers: 0
edited November 2015 in Free community support
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>

Answers

  • janpanjanpan Posts: 19Questions: 4Answers: 0

    Hi,

    What do you mean by : " how-to-find-sum-for-datatable"

    Do you want the amount of rows displayed ?

  • srinivaasansrinivaasan Posts: 2Questions: 1Answers: 0

    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()); } ); });
This discussion has been closed.