The site keep showing "Datatables warning id = example - 200"
The site keep showing "Datatables warning id = example - 200"
yiurenma
Posts: 7Questions: 4Answers: 0
Hi Allan
I have use the server side function of datatables. but when once it gets the data successfully, the site keep showing "datatables warining id = example - 200" as below image shows . Do you have any idea for this ? should I write a success function or something ?
"dom": "B<'clear'>frtlip",
"serverSide": true,
"scrollX": 200,
"lengthMenu": [10, 20, 30],
"ajax": {
"url": apiEntry,
"dataType": "json",
"type": "post",
"data": function(d) {
draw = d.draw;
if ($(".input-sm").val()) {
var dataTableParams = {
"mStId": "0000000",
"content": $(".input-sm").val(),
"rfmLevel": "1"
};
return $.extend(dataTableParams, getDataTableParams(d, "post", "/clCrm/api/crm/users/table/datas/search"));
} else {
var dataTableParams = {
"mStId": "0000000",
};
return $.extend(dataTableParams, getDataTableParams(d, "post", "/clCrm/api/crm/users/table/datas/all"));
}
},
"dataFilter": function(data) {
var resultJson = jQuery.parseJSON(data);
resultJson.draw = draw;
if (resultJson.page) {
resultJson.recordsTotal = resultJson.page.totalCount;
resultJson.recordsFiltered = resultJson.page.totalCount;
resultJson.data = resultJson.dataList;
} else {
resultJson.recordsTotal = resultJson.dataList.length;
resultJson.recordsFiltered = resultJson.dataList.length;
resultJson.data = resultJson.dataList;
}
return JSON.stringify(resultJson);
}
},
"buttons": ['csv'],
"columns": [{
"data": "telephone"
}, {
"data": "patientName"
}, {
"data": "customTagStr"
}, {
"data": "rfmLevel"
}, {
"data": "cLastDays"
}, {
"data": "cCount"
}, {
"data": "cTotalMoney"
}, {
"data": "cUnitPrice"
}, {
"data": "cLastStoreName"
}, {
"data": "diseaseStr"
}, {
"data": "hLastDays"
}, {
"data": "hCount"
}, {
"data": "hLastStoreName"
}],
"oLanguage": {
"sLengthMenu": "每页显示数量 _MENU_ ",
"sZeroRecords": "对不起,查询不到任何相关数据",
"sEmptyTable": "未有相关数据",
"oPaginate": {
"sPrevious": "<img src='images/ic_left.png'>",
"sNext": "<img src='images/ic_right.png'>"
}
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Without a link to the page I can't say for sure, but my guess is that the JSON response from the server contains an
error
property, and that is what you are seeing.Allan
Hi Allan
That actually the root cause. Thanks !