Pagination Question
Pagination Question
I am loading my data with a server-side webmethod. When my data loads, it shows 10 records, and it shows the correct number of total records at the bottom of the table, like this:
Showing 1 to 10 of 10 entries (filtered from 33,586 total entries)
However, the paging is greyed out and only shows 1 page. I am setting the iTotalRecords to the correct record count. Is there anything else I need to do? Here is my client code below.
Thanks!!
[code]
$("#grid").dataTable({
"bJQueryUI": true,
"iDisplayLength": 10,
"aaSorting": [[0, "asc"]],
"sPaginationType": "full_numbers",
"bServerSide": true,
"bProcessing": true,
"bPaginate": true,
"sAjaxSource": "WebService.asmx/GetData",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"type": "POST",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"data": "{'sEcho': '" + aoData[0].value + "', 'search': '" + fnGetKey(aoData, "sSearch") + "', 'start': " + fnGetKey(aoData, "iDisplayStart") + ", 'length': " + fnGetKey(aoData, "iDisplayLength") + "}",
"success": function (json) {
fnCallback(json.d);
}
});
}
});
[/code]
Showing 1 to 10 of 10 entries (filtered from 33,586 total entries)
However, the paging is greyed out and only shows 1 page. I am setting the iTotalRecords to the correct record count. Is there anything else I need to do? Here is my client code below.
Thanks!!
[code]
$("#grid").dataTable({
"bJQueryUI": true,
"iDisplayLength": 10,
"aaSorting": [[0, "asc"]],
"sPaginationType": "full_numbers",
"bServerSide": true,
"bProcessing": true,
"bPaginate": true,
"sAjaxSource": "WebService.asmx/GetData",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"type": "POST",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"data": "{'sEcho': '" + aoData[0].value + "', 'search': '" + fnGetKey(aoData, "sSearch") + "', 'start': " + fnGetKey(aoData, "iDisplayStart") + ", 'length': " + fnGetKey(aoData, "iDisplayLength") + "}",
"success": function (json) {
fnCallback(json.d);
}
});
}
});
[/code]
This discussion has been closed.
Replies
I thought this was the number of records displayed on the page (page size)
Now I am setting "iTotalDisplayRecords" and "iTotalRecords" to be the same and it works.
Thanks