Iterator

Pretty often developers need to use iterators in their code. It's useful when you need to apply the same operation to all items. So we decided to give this subject individual consideration.

The forEachItem method calls a user-defined function for every existing item and passes an item's object into it. For example, you can use the hideHeader method to hide headers of all items in the layout:


// calling iterator
myLayout.forEachItem(function(cell){
    // actions, for example:         
    cell.hideHeader();
});
 
//or
function doItemAction(cell) {
    // actions, for example:
    cell.hideHeader();
}
// calling iterator
myLayout.forEachItem(doItemAction);


Related sample:  Iterator

Back to top