varying column number error
varying column number error
I have a varying amount of columns for each run. It seems that the below example works if i hardcode everything.
var data_array =[{'data': 'detail1'}, {data: 'detail2'}, {data: 'detail3'},
$('#example').DataTable( {
ajax: {
url: api_url,
},
columns:data_array});
});
However if i would to do something like this, it does not work at all. I get something like this from the start jquery.dataTables.min.js:66 Uncaught TypeError: Cannot read property 'aDataSort' of undefined.
var data_array = []
for(var i = 0; i < 10; i++){
data_array.push({'data': "detail"+ i.toString()})
}
Answers
Can you show us the full code you are using please, ideally with a link to a test case as requested in the forum rules.
Allan