Search code examples
javascriptdhtmlx

Dhtmlx foreachRow does not work


I have this code, but inside foreachRow function nothing happens look:

SYSTEM.Grid.load(urlLoad);


 SYSTEM.Grid.forEachRow(function(id){
    console.log("teste");
}

Any ideas for solve this?


Solution

  • The function "SYSTEM.Grid.load(urlLoad);" runing asynchronously so you need to use a callback to put the foreachRow function. That way it only after the entire grid is loaded will execute its function correctly:

    SYSTEM.Grid.load(urlLoad, function(){
        SYSTEM.Grid.forEachRow(function(id){
            console.log("teste");
        }
    });