Hello,
I wrote JS to compute the sum of a column(C006) in a IG. The aim is to set the last edited column to a value so that the sum of all columns should not have mor then 100, because it is the percentage of the Industry a company can have.
The IG is based on a Apex Collection. The script is executed by a DA on "Lose Focus"

and works as follows:
var widget = apex.region('Industries_SID').widget();
var grid = widget.interactiveGrid('getViews','grid');
var model = grid.model;
var val =0, total =0;
model.forEach(function(func) {
val = Number(model.getValue(func,"C006"));
console.log('this is '+val);
total += val;
});
alert(total);
It works well, more or less, the problem is, if I have initial values:
And if I change on Value
it is still 100. but it should be 60 in this case.
Any ideas what I did wrong ?
KR