Hello,
Hope all are fine.
In my master-detail form, i want to show summation result of detail table grid field value. Detail table field name is return_quantity and result will show on pre_approval field of master table. I placed the below code on Table Specific->Add/Copy Page->Client Script of master table:
var $form = $('#fgrayreturn_hubadd'),
$summands = $form.find('[data-field="x_return_quantity"]'),
$sumDisplay = $('#x_pre_approval');
$form.on('change', '.form-control', function () {
var sum = 0;
$summands.each(function () {
var value = $(this).val();
value = parseFloat(value);
if (!isNaN(value)) {
sum += value;
}
});
sum = sum.toFixed(2);
$sumDisplay.val(sum);
console.log('st:', sum);
});
Using the above code first row of return_quantity field value is showing on pre_approval field of master table. But 2nd row and so on row of detail table return_quantity field value is not doing sum. Console log also showing first row value without any error. I don't find any solution of that. Can experts identify where the mistake is and why all the rows value of details table is not doing summation and showing the result on the defined master table field?
Thanks in Advance.
Regards