Issue with pagination

Issue with pagination

dirtykalbdirtykalb Posts: 4Questions: 1Answers: 0
edited March 2014 in DataTables 1.9
Hello,

I am having an issue with the pagination and have not seen anything similar in my search for an answer. Unfortunately, I cannot post the page to a live server as the data is currently unavailable in a public environment.

My initialization code is as follows:
[code]
var dataset = $('#MainTable').dataTable({
"bPaginate": true,
"sPaginationType": "full_numbers",
"bJQueryUI": false,
"bAutoWidth": false,
"iDisplayLength": 5,
"bServerSide": true,
"sAjaxSource": '@Url.Content("~/Home/GetData")',
"sServerMethod": "POST",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
type: "POST",
url:sSource,
data:aoData,
dataType: "json"
}).done(
function (json) {
fnCallback(json.d)
}
);
},
"oLanguage": {
"sLengthMenu": 'Display ' +
'5' +
'10' +
'15' +
'All' +
' records'
},
"aoColumns": [
{ "sTitle": "id" },
{ "sTitle": "account" },
{ "sTitle": "name" },
{ "sTitle": "c1" },
{ "sTitle": "c2"}
]
});
[/code]

my initial response from the server side is:
[code]
{"d":{"sEcho":1,"iTotalDisplayRecords":5,"iTotalRecords":17,"aaData":[[37,"Greedo11 sadf","Queens of the Stone Age","0","0","06/23/2013","07/06/2013"],[62,"","PatTest","0","0","12/04/2013","12/31/2013"],[64,"","PatTest","0","0","12/04/2013","12/31/2013"],[66,"Greedo11 sadf","Queens of the Stone Age","0","0","06/23/2013","07/06/2013"],[69,"Greedo11 sadf","asdfasdf","0","0","12/13/2013","02/05/2014"]]}}
[/code]

When chainging the display x records dropdown the response grows as requested, and when searching the search returns as requested, however, the pagination always returns as if there is a single page and the buttons are classed as disabled. If i return all the records (rather than taking only the iDisplayStart - iDisplayLength) the page shows all the records and ignores the display dropdown.

Any help would be appreciated!

Thanks!
Justin

Replies

  • dirtykalbdirtykalb Posts: 4Questions: 1Answers: 0
    edited March 2014
    I also ran the debugger and it returned the following url:
    http://debug.datatables.net/ubotak
  • dirtykalbdirtykalb Posts: 4Questions: 1Answers: 0
    BAH! i finally figured it out. Was returning the wrong iTotalRecords because of search term.
This discussion has been closed.