Server processing - page number not work

Server processing - page number not work

NomanoclassNomanoclass Posts: 5Questions: 0Answers: 0
edited April 2015 in Free community support

Hello,

I have edit the code of the exemples(https://www.datatables.net/examples/server_side/post.html)

    $columns = array();
    foreach($_POST["columns"] as $column)
    {
        array_push($columns, array("db" => $column["data"], "dt" => $column["data"]));
    }

    include_once("ssp.class.php");

    echo json_encode(SSP::simple($_POST, $connection, $_POST["table"], $_POST["id"], $columns));

when I click on page number I have this error: "DataTables warning: table id=test - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1"
But "Previous" and "Next" work fine...

Thank you for your futur help.

Replies

  • larsonatorlarsonator Posts: 54Questions: 4Answers: 2

    try debugging in your network console what parameters are sent, and what data is returned when you press one of the numbers, and how it is different when you press the next or previous buttons.

    make sure it lines up with the doccumentation here: https://datatables.net/manual/server-side

    sounds like you could be getting a php error returned? remember when you are using server processing, it is up to the server to present the information data tables has requested, which means you will probably end up using most of the parameters passed.

  • NomanoclassNomanoclass Posts: 5Questions: 0Answers: 0
    edited April 2015

    I forgot to write it, there currently are no answer.
    However, I will see what is sent.

    EDIT:
    parameters:
    for next: start = 10
    for 2: start = 0

    and page number work if the "next" button has already gone on page number...

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin

    Did you follow the instructions in the tech note? If so, what is being returned that is making it invalid JSON?

    Allan

  • NomanoclassNomanoclass Posts: 5Questions: 0Answers: 0

    Nothing is returned.

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin

    That would do it. An empty string is not valid JSON. There might be an error in the script when processing the first request - you might want to start by look in the server's error logs.

    Allan

  • NomanoclassNomanoclass Posts: 5Questions: 0Answers: 0
    edited April 2015

    I have tested and it is certain pages who bug, I'll see what's wrong in these pages.

    EDIT:
    I think I found ... I warn you as soon as I finish the tests.

  • NomanoclassNomanoclass Posts: 5Questions: 0Answers: 0

    In ssp.class.php, the PDO connection hasn't set the charset to utf8...
    Thank you very much for your responses.

This discussion has been closed.