DataTable next page not working

DataTable next page not working

aravinthkulaaravinthkula Posts: 2Questions: 1Answers: 0

I have done the pagination coding, if I click next page it won't refresh and display the next set of data in DataTable. I sent only next set of data only but it won't over write the previous data. Could you please help me on this. For your reference here I give my code.

$(document).ready(function() {

    var $tblData = $("#tblData");

    var oTable = $tblData.DataTable({

        "order": [[1, "asc"]],
        "bProcessing": true,
        "bServerSide": true,
        "aLengthMenu": [[10, 20, 30, 40, 50, 500, -1], [10, 20, 30, 40, 50, 500, "All"]],
        "iDisplayLength": 10,
        "bPaginate": true,
        "bFilter": false,
        //"bStateSave": false,
        //"sPaginationType": "full_numbers",
        "bDestroy": true,
        "bDeferRender": true,
        //"bJQueryUI": true,
        "sAjaxSource": "Default.aspx/GetDataTable",
        "aoColumns": [{ "sName": "PatientId",
            "bSortable": false,
            "mRender": function(data, type, full) {
                return '<input type="checkbox" id="' + data + '">';
            }
        },
        { "sName": "Patient"
        },
          { "sName": "Collected" },
          { "sName": "TestType" },
           { "sName": "OrderingPhys" },
           { "sName": "CaseNumber",
               "mRender": function(data, type, full) {
                   return '<a href="#" style="text-decoration:underline;">' + data + '</a>';
               } 
           },
           { "sName": "Status" },
           { "sName": "PatientId",
               "bSortable": false,
               "mRender": function(data, type, full) {

                   return '<a class="Report-Notes" href="#"></a>';

               }
           }

],
"fnServerData": function(sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "GET",
"url": sSource,
"data": aoData,
"success": function(msg) {
//debugger;
var json = JSON.parse(msg.d);
fnCallback(json);
$("#tblData").show();
//$tblData.fnDraw();
},
error: function(xhr, textStatus, error) {
if (typeof console == "object") {
alert(xhr.status + "," + xhr.responseText + "," + textStatus + "," + error);
}
}
});
},
"language": {
"emptyTable": "No Records Found"
}
});

    $('.dataTables_info').appendTo('.datatable-footer');
    $('.dataTables_paginate').appendTo('.datatable-footer');
    var allPages = oTable.cells().nodes();


    $('#SelectAllChk').click(function() {
        //debugger;
        if ($(this).hasClass('allChecked')) {
            $(allPages).find('input[type="checkbox"]').prop('checked', false);

        } else {
            $(allPages).find('input[type="checkbox"]').prop('checked', true);
        }
        $(this).toggleClass('allChecked');
    })

});  
This discussion has been closed.