I'm trying to use datatables with server-side functionality. But when it tries to fetch data giving me this error; after dismissing it, reloading the data properly.
DataTables warning: table id=clientTable -
As you can see; there is no explanation of the warning. Also I don't have any console warnings. Here are my codes:
Table HTML
<table class="table table-striped table-hover table-bordered" id="clientTable">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Phone</th>
<th>Mail</th>
<th>Date</th>
<th>Auto</th>
</tr>
</thead>
</table>
datatables initialization
$('#clientTable').dataTable({
"iDisplayLength": 20,
"processing": true,
"serverSide": true,
"ajax": clientApiConstant,
"columns":
[
{ "data": "id",},
{ "data": "name" },
{ "data": "phone" },
{ "data": "mail" },
{ "data": "date" },
{ "data": "auto" }
]
});
Client Api Response
{
"data": [
{
"id": 2,
"name": "John Doe",
"date": "2017-04-04T00:00:00+0000",
"mail": "arda@asd.com",
"phone": "123123123",
"auto": true
},
{
"id": 3,
"name": "Doe John",
"date": "2017-04-22T00:00:00+0000",
"mail": "nihatcan@asd.com",
"phone": "234234234",
"auto": false
}
],
"recordsTotal": 2,
"recordsFiltered": 2,
"error": []
}
Response to Dipak's answer; this is where my datatables.js fails:
function K(a, b, c, d) {
c = "DataTables warning: " + (a ? "table id=" + a.sTableId +
" - " : "") + c;
d && (c += ". For more information about this error, please see http://datatables.net/tn/" + d);
if (b)
E.console && console.log && console.log(c);
else if (b = m.ext, b = b.sErrMode || b.errMode, a && s(a, null, "error", [a, d, c]), "alert" == b)
alert(c);
else {
if ("throw" == b)
throw Error(c);
"function" == typeof b && b(a, d, c)
}
}
at "function" == typeof b && b(a, d, c) line; line no 1763 @ version 1.10.15