Padma Padma - 1 year ago 205
Groovy Question

Unable to set iTotalRecords and iTotalDisplayRecords in datatable

The datatable is showing the aaData values but the pagnation is wrong.

"bProcessing": true,
"bServerSide": true,
"sAjaxDataProp": function ( json ) {
var msgObj = JSON.parse(json);
return msgObj.aaData ;
} ,

"aoColumns": [

{ "data": "scheduleId" },
{ "data": "startTime" },
{ "data": "endTime" },
{ "data": "selectFlag" }


This is the json data:


Below I have attached the image of datatable.


Can you please point out the mistake I have made?

Answer Source

Remove sAjaxDataProp option, it's not needed. Also your JSON response is missing sEcho parameter, which is unaltered copy of sEcho sent from the client side.

See Example JSON return for more details.

See this example for code and demonstration. Please note that the example will not sort/filter/paginate correctly because there is no server-side script available.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download