iDisplayStart Server-Side Not Working Correctly

iDisplayStart Server-Side Not Working Correctly

nindoonindoo Posts: 2Questions: 0Answers: 0
edited June 2011 in DataTables 1.8
Hello,

I am having trouble with server side paging of my data grid. Even though I am setting the iDisplayStart to 20 in my json data, after the server side data is fetched my grid always indicates that records 1-10 are being displayed. I have included my code below and a picture of the output. [I am using jquery.dataTables.js V 1.8.0]

C# Json data
[code]
var jsonData = new
{
iDisplayStart = 20
,iDisplayLength = 10
,iTotalRecords = 100
,iTotalDisplayRecords = 100
,aaData = dataitems
};
[/code]

JavaScript Datatable initialization
[code]
oTable = $('#usersTable').dataTable({
"bJQueryUI" : true
,"bProcessing": true
,"bServerSide": true
,"bSort" : true
,"bPaginate" : true
,"bFilter" : false
,"aoColumns": [ { "mDataProp" : "Username" }
,{ "mDataProp": "Email" }
,{ "mDataProp": "Status" }
,{ "mDataProp": "Comments" }]
,"sAjaxSource": "<%=Url.Content("~/UserAdministration/GetGridData")%>"
});
[/code]

Here is the output
http://img37.imageshack.us/img37/5928/samplegrid.jpg

Replies

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    Hi nindoo,

    iDisplayStart and iDisplayLength and both sent to the server, from the client-side - they should not be present in the JSON that is returned as they will have no effect (the client-side maintains it's own state). It is expected that the server will operate on the values of iDisplayStart and iDisplayLength that are sent to the server.

    A list of the parameters which are sent and those which should be returned are available here: http://datatables.net/usage/server-side . A running examples can be seen here (it can be useful to look at the XHR in Firebug to see what is happening): http://datatables.net/release-datatables/examples/server_side/server_side.html

    Regards,
    Allan
  • nindoonindoo Posts: 2Questions: 0Answers: 0
    Thanks Allan, that makes sense.
This discussion has been closed.