Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

Issue with pagination

$
0
0
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:
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 <select>' +
            '<option value="5">5</option>' +
            '<option value="10">10</option>' +
            '<option value="15">15</option>' +
            '<option value="-1">All</option>' +
            '</select> records'
            },
            "aoColumns": [
            { "sTitle": "id" },
            { "sTitle": "account" },
            { "sTitle": "name" },
            { "sTitle": "c1" },
            { "sTitle": "c2"}
            ]
        });

my initial response from the server side is:
{"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"]]}}

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

Viewing all articles
Browse latest Browse all 1816

Trending Articles