each

each(function(item))

使用范围: client

编程语言: javascript

父类: Item 类

描述说明

Use each method to iterate over records of an item dataset. 使用 each 方法来迭代访问一个实体项所拥有的记录。

each 方法指定了一个函数,这个函数会为每条记录执行。

通过使回调函数返回 false ,你能在一个特定的迭代中终止 each 循环。

示例

下面的示例中, titem.invoice_table 都指向了同一个对象。

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;
});

另请参见

导航数据集