using javascript arrays for aaData

using javascript arrays for aaData

pedalshoepedalshoe Posts: 9Questions: 0Answers: 0
edited October 2011 in DataTables 1.8
i have a 2d javascript array defined as:
var myData = new Array(1)
myData [0] = new Array();

and I insert data into the array:
var i=0;
myData[0][i++] = "myData1";
myData[0][i++] ="myData2";

when i initialize my single column dataTable using:

the data table only shows one row of data. (the first record only)

Is there something I'm doing wrong here?

Thank you,


  • pedalshoepedalshoe Posts: 9Questions: 0Answers: 0
    This link helped me understand what was missing..

    Instead of trying to make a 2d array, i just inserted the new row by using push(["myDataN"]);
    using the square brackets to specify an array (although it is only one element).

  • Mango_DeliciousMango_Delicious Posts: 1Questions: 0Answers: 0
    This was my problem too! After an hour I found this page, made my morning, thanks.

    Here's my sample code too, just for anyone else in the future:

    // Processing JSON data into an array
    for (i=0; i
  • dj_mckingdj_mcking Posts: 1Questions: 0Answers: 0
    thanks Mango_Delicious i came across this just in time. :) and works like a charm.
  • allanallan Posts: 50,883Questions: 1Answers: 7,626 Site admin
    There is an example showing how to do this here: . You want want to also consider enabling deferred rendering ( bDeferRender ) for a bit more speed :-)

This discussion has been closed.