Unable to set property
Unable to set property

Hello,
I dynamically create a table after an Ajax call, then initialize it as a Datatable, then do rows.add(rows).
$("#ReportTable").DataTable({
"destroy": true,
"lengthChange": false,
"stateSave": false,
"sort": false,
"paging": false,
"dom": "rt",
"columns": tableCols
});
The Table does not populate with the rows that I give it. If I take out the "destroy" property, it will populate the 2nd time I run the script.
The first time the script runs I get "Unable to set property '_DT_CellIndex' of undefined or null reference".
jquery.dataTables.js (1765,4)
Subsequent times I get "Unable to get property 'parentNode' of undefined or null reference"
jquery.dataTables.js (9149,3)
http://live.datatables.net/jecikohi/1/
The errors don't show on the test page.
Thank you,
This question has an accepted answers - jump to answer
Answers
You are getting this error in your example:
The problem is the HTML table has just one column but you are trying to build a Datatable with more than one column. You can use the
columns.title
to have Datatables build the columns. YourtableCols
variable would need bothcolumns.data
andcolumns.title
objects.Kevin