Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Biju on Jan 27, 2009 04:40
open dhtmlx forum
Adding rows to Grid

Hi,

I am running into some problem... It is taking too much time to add rows to the grid.
Following is a code sample where I add 360 rows but it is taking more than 90 seconds.
Why is it so slow?

    //initlializing grid with empty rows
    function initSchedule() {
        sgTrans.clearAll();
        for (i = 1; i < 360; i++) {
            myrow = new Array(i, "","", "", "","","","");  
            sgTrans.addRow(i, myrow);
        }
        return true;
    }

Thanks,
Biju


Answer posted by Support on Jan 27, 2009 04:55
Adding rows one by one is slowest way to fill the grid with data
You can 

a) use grid.parse and js array of data to load all rows at once
or 
b) use dhtmlxgrid_fast.js as 
sgTrans.startFastOperations();
  for (i = 1; i < 360; i++) {
  myrow = new Array(i, "","", "", "","","","");  
  sgTrans.addRow(i, myrow);
  }
sgTrans.stopFastOperations();