Pagination does not work with server data

Pagination does not work with server data

arondn2arondn2 Posts: 1Questions: 0Answers: 0
edited January 2012 in Bug reports
I have a service as PHP source which responds with a JSON string like the following:

{ "sEcho":"1", "iTotalRecords":6, "iTotalDisplayRecords":5,
"aaData":[ ["abeja", 1], ["burro", 2], ["mariposa",3], ["mariquita",4], ["pez",5] ]
}

DataTables should enable paging buttons, because it is only showing 5 of 6 records, but does not enable the buttons.

The server returns a string JSON as above and this is called the dataTable I do:

$("#listElements").dataTable({
bProcessing: true,
bServerSide: true,
iDisplayLength: 5,
bLengthChange: false,
bJQueryUI: true,
sAjaxSource: "animales.php/listarPalabras",
});

The rest of the features of DataTables work well, only the paging never enabled, no matter the records that exist.

Someone could help me with this problem or tell me if I'm doing something wrong?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > "iTotalRecords":6, "iTotalDisplayRecords":5,

    Unless you have a filter applied, these two parameter _must_ be the same: http://datatables.net/usage/server-side

    Allan
This discussion has been closed.