Dump rows from one datatable to another one

Dump rows from one datatable to another one

tbstartbstar Posts: 1Questions: 0Answers: 0
edited November 2011 in General
I've tried to do this row by row using each and fnAddData but it freezes the browser if I have a lot of records. Is there a way to do a bulk insert?

tBS

Replies

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    fnAddData accepts an array of arrays which is much more efficient when adding a lot of rows. I'd suggest building an array of all of the rows you want to add first and then pass that to fnAddData.

    Allan
  • gurusudhakargurusudhakar Posts: 6Questions: 0Answers: 0
    edited January 2012
    Thanks allan for your inputs , i was also facing the similar issue.

    I am building fnData array initially and passing into fnAddData. It shows pop up message saying stop running this script esp in IE browsers.
    I am expecting more than 200 records in datatable it works only 150 records in IE, even i tried disabling sort for all the columns in datatable but not helped.

    My code is something like below..

    var fnData=[testdatexml,starttime,endtime,totalseats,availableseats,seatsReserved,candidatecount,
    maxTestDuration,sessionInfostatus];

    oTable.fnAddData( [fnData] );

    Kindly advice what needs to be done.

    Gs
  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    Are you passing in a 1D array to fnAddData multiple times (which will harm performance as it will redraw the table every time) or as a 2D array?

    One thing you could do is enable bDeferRender - that will help get a bit of a speed boost.

    Allan
This discussion has been closed.