Unexpected behavior of DataTable with weird data in valid JSON - Only header and footer is shown

Unexpected behavior of DataTable with weird data in valid JSON - Only header and footer is shown

WarrrriorWarrrrior Posts: 3Questions: 1Answers: 0
edited August 2017 in Free community support

I came across an unexpected behavior of DataTable, if I have weird data in a valid JSON, which I attach to it.
I know that my data is somehow weird for the DataTable.js (server side responds with a valid JSON including all rows I want to show).
It happens only for specific values of the data, if I have different values in the data, it works.
What I want is to investigate why the data is weird by some alert or by some text instead of weird row - this would be much more better.
What I have got is a table with empty body and the response of $.ajax.success function(json) with NO ROWS instead of 4 ROWS from server response. Strange thing is that if I have no rows I should see "No Data Found..." in the body. So, I think that there must be some exception, but I do not know how to handle it.
I tried many examples from Stack Overflow, but nothing worked... this or for example this
Can somebody provide a simple example how to catch exceptions in DataTable.js? Or do you have some special advice for this problem?

Thank You so much!

Answers

  • WarrrriorWarrrrior Posts: 3Questions: 1Answers: 0

    Server responds with 4 rows, but message given to ajax contains no rows, is there something wrong with aoData?
    "fnServerData": function (sSource, aoData, fnCallback) { $.ajax({ "dataType": 'json', "contentType": "application/json; charset=utf-8", "type": "GET", "url": sSource, "data": aoData, "async": false, "cache": false, "success": function (msg) { console.log("JSON:"); console.log(msg);

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    if I have weird data in a valid JSON

    What do you mean by "weird"?

  • WarrrriorWarrrrior Posts: 3Questions: 1Answers: 0

    Parser Error of JSON not visible in Visual Studio - solved.

This discussion has been closed.