Check documentation for the latest version of dhtmlxSuite Iterator DHTMLX Docs

Iterator

The method forEachItem() calls a user-defined function for every existing item and passes an item's object into it. It can be useful when you need to apply the same operation to all items.


myAcc.forEachItem(function(cell){
    // your code here
});
// or
function doWithItem(cell){
    // your code here
});
myAcc.forEachItem(doWithItem);


For example, you can use setText() method to set the same text for headers of all the items in the accordion:


myAcc.forEachItem(function(cell){
    cell.setText("new text");
});


Related sample:  Iterator

Back to top