I have the dataSource defined as
function getData(){
var arr = [];
for(var i=0; i<1000; i++){
var obj = {
'name': 'John', 'company' : 'ABC Corp', 'salary': '$x'
};
arr.push(obj);
}
return arr;
}
The table is being rendered as
var arr = getData();
$('#table1').dataTable({
'aaData': arr,
'aoColumns': [
{'sTitle': 'name'},
{'sTitle': 'company'},
{'sTitle': 'salary'}
]
}}
Now when i try to add a new row to the dataTable as
$('#table1').dataTable.fnAddData([
" ", " ", " "
]);
I get an error as
DataTables warning (table id = 'table1'): Requested unknown parameter 'name' from the data source for row 1001
What can be causing this?