$(table).DataTable().data() is an empty object

$(table).DataTable().data() is an empty object

sagimannsagimann Posts: 18Questions: 9Answers: 0

Hi all,
I have a table with 1 visible row, working well.

At some point I want to run some script to access the table's data, so I call:
var rows = $(table).DataTable().data()
console.log(rows)

this outputs:
Object {}

Here is how the table is initialized:

$(table).dataTable( {
"sDom": "Tfrtip",
"aaData": [
{
"name": "xxx",
"link": "yyyy"
}
],
});

any idea why data() is empty? According to the example, it should contain 1 row in my case.
tnx

Answers

  • sagimannsagimann Posts: 18Questions: 9Answers: 0

    found the reason:
    while I was working with DT, the website has changed, with docs now pointing to 1.10 instead of 1.9.... so I was trying to use 1.10 API on top of 1.9... I switched to 1.10 and now it works...

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Nice one. For reference, if you want the old 1.9 documentation, it is available at legacy.datatables.net.

    Allan

This discussion has been closed.