I'm developing web using PHP and CI Framework. I have problem in getting data from table view in web. So, I have table that has 16 entries, the table show 10 entries in the first page and 6 entries in the second page. Then I have on change function after edit field value in the table, here is my code.
function hitungTotalAmount(total)
{
alert(total);
var total_amount = 0;
var amounts = document.getElementsByName('amount[]');
var oke = amounts.length;
alert(oke);
for (var i = 0; i < amounts.length; i++)
{
var h = amounts[i].value;
const values = h.replace(/,/g, '');
var h = parseFloat(values);
total_amount = total_amount + h;
}
let tot = parseFloat(total_amount).toLocaleString('en-US', {
style: 'decimal',
maximumFractionDigits: 2,
minimumFractionDigits: 2
});
$("#total_amount").val(tot);
$("#invoiceamountdpp").val(tot);
$("#span-total_amount").text(tot);
}
In this code, I only get my active element which in my current open page. If I open in the first page that has 10 entries, the amount.length value is 10. I need to get all datas in all pages. I want to get 16. How could I do that? Thank you so much for your help.