I have a DataTables table that is initially filled by a JSON Array (directly written to HTML with ASP.NET). Now I want to refresh this data with Ajax but the data simply won't be added. I want to use my own method, not DataTables' internal Ajax method. (Using DataTables 1.10.0).
$.getJSON("?ajax=1", null, function(json, status, xhr) {
var table = $("#" + proTableId).DataTable();
oSettings = table.settings();
//table.clear();
table.rows().remove();
var data = table.data();
for (var i = 0; i < json.length; i++)
{
data.push(json[i]);
}
table.draw();
});
The JSON result is correct but after this call the DataTable is always empty. How do I replace the Data inside the DataTables object and preferably keep sorting and filtering?