DataTables warning: table id=ProductList - 5

DataTables warning: table id=ProductList - 5

OzPenguinOzPenguin Posts: 14Questions: 3Answers: 0

I have checked the error messages listed at https://datatables.net/manual/tech-notes/ and none of these seem to match. They all have an error description listed after the - and all I am seeing is a 5.

Code has been very stable for months, but this morning, I started getting the message
DataTables warning: table id=ProductList - 5
It only appears for some data being populated, so I know it is data related, but the JSON being returned appears to be well formed.

Version being used:

<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css"
<script type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>

Can anyone help with what the 5 means ?

This question has an accepted answers - jump to answer

Answers

  • OzPenguinOzPenguin Posts: 14Questions: 3Answers: 0

    Now I am not so sure that it is a data problem.

    I have narrowed it down, so that search criteria that returns just two rows, which can reproduce this error.

    But if I then restrict the search to either one of these products, then I don't get the error.

    So it appears to be something about the combination of these two rows in the same result set that is cause of the problem for me.

    I really need to get a better understanding of what the 5 means.

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Weird. DataTables should always give an error code and then a description. I'm not sure what would cause just 5 to appear.

    Can you link to a page showing the issue?

    Thanks,
    Allan

  • OzPenguinOzPenguin Posts: 14Questions: 3Answers: 0

    I could give a private link, but the site is live production data.

    Otherwise need to try and reproduce the problem on the test site with fake data. I don't think this is likely as I can't work out what is causing the scenario (catch 22)

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    You can send me a link privately by clicking my name above and then the Send message button.

    Allan

  • OzPenguinOzPenguin Posts: 14Questions: 3Answers: 0

    My humble apologies for wasting the time of all those people who took the time to read this.

    I just realised that my debugging page was not showing quite the same products by and once I addressed that issue (to get the same search criteria) then I saw that there really is malformed JSON.

    The data request experienced an error:
    JSON Error 5 - Malformed UTF-8 characters, possibly incorrectly encoded
    and then returned:

    {
        "result": "error",
        "data": [],
        "error": 5,
        "errormessage": "Malformed UTF-8 characters, possibly incorrectly encoded"
    }
    

    This must be where the 5 was coming from in the error message

    I presume that I am not returning the error in the ideal way, comments on how I should do this are most welcome.

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    Answer ✓

    DataTables will show whatever is in the error parameter, which explains why it is just showing 5 in this case!

    Allan

  • OzPenguinOzPenguin Posts: 14Questions: 3Answers: 0

    Thanks Allan

    I will change the error response to:

    {
        "result": "error",
        "data": [],
        "errorid": 5,
        "error": "Malformed UTF-8 characters, possibly incorrectly encoded"
    }
    
This discussion has been closed.