I am starting to get frustrated... Banging my head on the desk. I just can't figure out why this keeps throwing an error.
I was initialising my table:
var table = $('#table').DataTable({
data: dataSet,
columns: [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ title: "RO Number" },
{ title: "Dept" },
{ title: "Age" },
{ title: "Age Cat" },
{ title: "RO Advisor" },
{ title: "RO Sales Amount" }
]
});
This was fine - What I want is to re-initialise within page, so I added the following few lines prior which is what the documentation advised but I can't get to work - I want to get the table instance, clear it, then re-initialise it but it is proving way beyond my skillset...
var table = $('#table').DataTable();
table.clear().draw();
var table = $('#table').DataTable({
data: dataSet,
columns: [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ title: "RO Number" },
{ title: "Dept" },
{ title: "Age" },
{ title: "Age Cat" },
{ title: "RO Advisor" },
{ title: "RO Sales Amount" }
]
});
Which results in: Uncaught TypeError: Cannot read property 'aDataSort' of undefined
I then tried
var table = $('#table').DataTable();
table.destroy();
Same error: Uncaught TypeError: Cannot read property 'aDataSort' of undefined
I then tried to specifically tell it to grab the instance:
var table = $('#openro-data').DataTable( { retrieve: true } );
Same error: Uncaught TypeError: Cannot read property 'aDataSort' of undefined
Why can't i grab the table instance, destroy it, and re-initialise it?
The dataSet is a javascript array within the page so should be easily accessed...