Skip to main content

forEach()

iterates over all specified layout cells

forEach(callback: (cell: object, index: number, array: array) => any, parentID: string, level: number): void;

Parameters:

  • callback: function - a function that will iterate over specified Layout cells. The callback function takes three parameters:
    • cell - the object of a layout cell
    • index - the index of a layout cell
    • array - an array with layout cells
  • parentID: string - optional, the parent id. If not specified, the function will start iterating over from the root item.
  • level: number - optional, the number of levels to be iterated over. If not specified, each nested level will be visited.

Example

layout.forEach(function(cell, index, array) {
console.log("This is a cell: ", cell);
console.log("This is a cell index: ", index);
console.log("This is an array of cells: ", array);
}, parentID, level);

Related sample: Layout. ForEach

Change log:

added in v6.4