How do I pull one element from the data array?

How do I pull one element from the data array?

DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
edited February 2012 in DataTables 1.8
I need one element from the data array...I don't know how to retrieve it...I tried this:

[code]
var aData2 = oTable.fnGetData();
alert(aData2[3]);
[/code]

It returns "undefined"...I need it to return the data from the table


Any ideas?

Replies

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    I would suggest you try:

    [code]
    var aData2 = oTable.fnGetData();
    console.dir(aData2);
    [/code]

    and look on the Javascript console at what is being returned from fnGetData. Given the error, I presume an array of < length 4.

    Allan
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    ok ill try it thanks for helping
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    when i did that alert function just to test what the variable would return, it came up with the entire array or at least one row within []....each value in the array is contained within quotes and separated by a comma...and its all in a text file...like this:

    [code]

    { "aaData": [["data1","data2","data3","data4","data5","data6","data7"]] }

    [/code]

    but i just wanna pull data4 out of there...but its returning that entire row instead
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    all set now thanks
This discussion has been closed.