feno noga
feno noga

Reputation: 9

oracle apex interactive grid get status when choose to delete

Good Morning! As in pic I have interactive grid with values and type (Debit or Credit) and a dynamic action javascript code that calculate sum of both types the problem is when the user choose to delete a row like the pic , I don't know how to get that status to remove the value of this row from the calculation... enter image description here

I have tried to use apex.item("APEX$ROW_STATUS") but it's not giving me any value anyone can point me to the right direction please....

thanks in advance

Upvotes: 0

Views: 811

Answers (1)

Koen Lostrie
Koen Lostrie

Reputation: 18640

Have a look at the "Interactive Grid cookbook v6" mentioned in this blog. Page 5 has an example of a page item that is updated on change of an interactive grid. In the implementation you can see how deleted rows are handled:

    function update(model) {
        var salKey = model.getFieldKey("SAL"), 
            total = 0;

        console.log(">> starting sum SAL column")
        model.forEach(function(record, index, id) {
            var sal = parseFloat(record[salKey]),  // record[salKey] should be a little faster than using model.getValue in a loop
                meta = model.getRecordMetadata(id);

            if (!isNaN(sal) && !meta.deleted && !meta.agg) {
                total += sal;
            }
        });
        $s("P5_TOTAL", total);
    }

The RecordMetadata of a row has a property "deleted" that you can check for the status of a row.

Upvotes: 1

Related Questions