Jam.py documentation

each

each(function(item))

domain: client

language: javascript

class Item class

Description

Use each method to iterate over records of an item dataset.

The each() method specifies a function to run for each record. You can break the each loop at a particular iteration by making the callback function return false.

Example

In the example below the t and item.invoice_table are pointers to the same object:

var subtotal = 0,
    tax = 0,
    total = 0;
item.invoice_table.each(function(t) {
    subtotal += t.amount.value;
    tax += t.tax.value;
    total += t.total.value;
});