How to get sum of column in interactive grid on click add row in Oracle APEX
1) create a page item p13_total as type display
2.2) Create dynamic on column on AMMOUNT
When
Event: Change
Selection Type:Column(s)
Region: LINE
Columns:AMMOUNT
True Action:
Set Value: PL/SQL Expression: :AMOUNT (This is very important, otherwise we always get the last column value )
submit: column AMOUNT
Execute JavaScript Code:
var model = apex.region("LINEID").widget().interactiveGrid("getViews", "grid").model; // LINEID is the region id of IG
var n_dist_amount, n_total = 0;
var col_gl_amount = model.getFieldKey("AMOUNT");
model.forEach(function(igrow)
{
n_dist_amount = parseInt(igrow[col_gl_amount], 10);
if (!isNaN(n_dist_amount)) {
n_total += n_dist_amount;
}
}
);
console.log(n_total);
$s('P13_TOTAL', n_total);
Affected Elements: P13_AMOUNT
Негізгі бет How to get sum of column in interactive grid on click add row in Oracle APEX
Пікірлер: 28