DataTables 1.10 - Stuck on Processing Remote

DataTables 1.10 - Stuck on Processing Remote

KerryJonesKerryJones Posts: 2Questions: 1Answers: 0

I posted this question to Stackoverflow but have received no help there:
http://stackoverflow.com/questions/24171141/datatables-1-10-not-showing-results


This is my setup.

Javascript/jQuery:

 $('#list').dataTable({
    paging: false,
    serverSide: true,
    ajax: {
        url: "/search/",
        data: function (d) {
            return $.extend({}, d, {
                lid: Label.selectedId
            });
        }
    }
});

HTML

<table id="list" class="table table-striped" width="100%">
    <thead>
    <tr>
        <th>Title</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>URL</th>
    </tr>
    </thead>
    <tbody>

    </tbody>
</table>

JSON Response

 {"data": [["Test", "", "", ""]], "recordsTotal": 1, "draw": 1, "recordsFiltered": 1}

It is getting called manually by doing this:

$('#list').DataTable().ajax.reload();

But the table does not change. I've done this many times with DataTables 1.9 without a hitch -- any ideas?

Answers

  • KerryJonesKerryJones Posts: 2Questions: 1Answers: 0

    Oh, ironically, I just found the answer.


    I found the problem. It was with the draw in the JSON response. It was always 1.

    If you use serverSide: true, that means it is going to send draw as a variable, and it must be returned.

    More information here: http://datatables.net/manual/server-side

This discussion has been closed.