iDisplayLength is not honored in server side processing

iDisplayLength is not honored in server side processing

steefsteef Posts: 2Questions: 1Answers: 1
edited May 2015 in Free community support

I am using jquery datatables 1.10.6 and implemented the code for server side processing as follows:

var dtable = $('#json_table_container').dataTable(
{
"iDisplayLength": 5,
"processing": true,
"serverSide": true,
"ajax":function (data, callback, settings)
{
$.ajax
({
contentType: "application/json",
url: 'valid url'
type: "POST",
data: JSON.stringify(data),
success: function (resultsFromServer)
{
callback(JSON.parse(resultsFromServer));
},
failure: function (xmlHttpRequest)
{
errorHandlerDefault(xmlHttpRequest);
}
});
},
"aoColumns" : JSON.parse(colHeaders).aoColumns,
"bDestroy": true,
"bJQueryUI": false,
"stateSave" : true,
"order": [],
"bLengthChange": false
});

After getting the data and when trying to render the data in datatables, it is displaying the full data in first page. It should ideally display 5 rows in first page as iDisplayLength is set to 5.

Can someone help me on this issue. Let me know if you need more details.

This question has an accepted answers - jump to answer

Answers

  • steefsteef Posts: 2Questions: 1Answers: 1
    Answer ✓

    Got it. We need to get the value sent by iDisplayLength(5 in my case) from client-side request using request.getParameter("length") on server-side and need to send only those number of records(5) in server-side response.

This discussion has been closed.