forEach()
iterates over all specified layout cells
forEach(callback: LayoutCallback, parentID: string, level: number): void;
Parameters:
callback: function
- a function that will iterate over specified Layout cellsparentID: 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
The callback function takes three parameters:
cell | (object) the object of a layout cell |
index | (number) the index of a layout cell |
array | (array) an array with layout cells |
Change log:
added in v6.4