DHTMLX Docs & Samples Explorer

### Iterator

Source

    <link rel="stylesheet" type="text/css" href="../../codebase/dhtmlxlayout.css">
    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxlayout_dhx_skyblue.css">
    <script src="../../codebase/dhtmlxcommon.js"></script>
    <script src="../../codebase/dhtmlxlayout.js"></script>
    <script src="../../codebase/dhtmlxcontainer.js"></script>

    <div id="parentId" style="position: relative; top: 20px; left: 20px; width: 600px; height: 400px; aborder: #B5CDE4 1px solid;"></div>
    <div id="srcDiv" style="position: relative; margin-top: 40px; left: 20px; width: 600px;">
        <input type="button" value="Update Names" onclick="update();">
    </div>
    <script>var names = new Array("Gothic 3 Forsaken Gods", "The Bard's Tale", "NFS Undercover", "The Punisher", "Diablo 2 Lord Of Destruction");
    var newNames = true;
    var j = 0;
    var dhxLayout;
    function doOnLoad() {
        dhxLayout = new dhtmlXLayoutObject("parentId", "5I");
    }
    function update() {
        dhxLayout.forEachItem(function(item) {
            item.setText(newNames ? names[j++] : item.getId());
        });
        newNames = !newNames;
        j = 0;
    }</script>