I'm referring to this solution to refresh a datatable. I obtained the newly refreshed JSON data through an ajax call. But I'm not sure how to use it. In particular, how do convert it to be compatible with the datatable aaData attribute?
success:
function (json){
var data = json;
table =$(#mytable).dataTable();
oSettings = table.fnSettings();
table.fnClearTable(this);
$.each(json, function (i, item) {
table.oApi._fnAddData(oSettings, json[i]);
});
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
table.fnDraw();
}
For now, I'm trying to directly use json[i] and that is giving me errors in datatable. Also , the returned data is an array of json objects.