Use this sample to sum up line item totals and copy the value to the totals field on the master table.
Place the code at: Client Scripts->Table Specific->List Page-> Startup Script
function calculateSum() {
var sum = 0;
//iterate through each textboxes and add the values
$("[data-field=x_line_total]").each(function () {// line total field in details field
//add only if the value is number
if (!isNaN(this.value) && this.value.length != 0) {
sum += parseFloat(this.value);
}
});
$("#x_inv_amount").val(sum.toFixed(2));// id of field in master table
}
<?php if(CurrentPageID() == "add"){?>
$("#tbl_detail_tablegrid").on("change", "[data-field=x_field_x]", function () {//activate fxn on change on specific field in detail table
calculateSum();
});
<?php }?>