2 grids on page, how to delay initialization for one of them

I have 2 grids on one page, Grid1 and Grid2. Upon load, Grid1 sends cell values to database (based on math formula).

Grid2 is populated with these values using supplied get.php. The trouble is when Grid2 loads, Grid1 has not yet sent the values to database so Grid2 cannot be populated.

I’d like to delay Grid2 loading or initialization so that Grid1 can calculate cell formulas and send values to database. Any idea how to do that? I tried using setTimeout but it didn’t work.


The next code will delay loading of second grid to the moment when first one will calculate math values ( I’m not pretty sure which code do you use to send those values back to server, so can’t recommend any steps there )

    var grid1= new …
    var grid2 = new …

       //next code will be executed only after data loaded in grid 1 and all math based values calculated