I am using Server-side processing (5,000,000 rows) Datatable Example

I am using Server-side processing (5,000,000 rows) Datatable Example

DurgzozoDurgzozo Posts: 2Questions: 1Answers: 0

Server-side processing (5,000,000 rows) Using This datatable and got
DataTables warning: table id=tata - Requested unknown parameter '0' for row 0, column 0. For more information about this error this Error..

Here is my Code

$(document).ready(function() {
var activeRows = [];
$('#tata').DataTable( {
serverSide: true,
ordering: false,
searching: false,
ajax: function ( data, callback, settings ) {
console.log('data',data);
$.ajax({
url: "{{ route('students.list') }}",
type: 'get',
dataType: 'json',
'data': data
}).done(function(res){
activeRows = res;
console.log(res);
callback(activeRows);
});
setTimeout( function () {
callback( {
draw: data.draw,
data: data,
recordsTotal: 5000000,
recordsFiltered: 5000000
} );
}, 50 );
},
scrollY: 200,
scroller: {
loadingIndicator: true
},
} );
} );

Answers

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945

    Looks like you are referring to this example. The example is structured with ajax as a function and the setTimeout to simulate 5,000,000 rows and a delay in fetching the data.

    Looks like you have a ajax.url to fetch the data so you won't want the extra code. Configure your server side processing like this example and add the scroller configuration. Something like this:

        $('#tata').DataTable( {
            serverSide: true,
            ordering: false,
            searching: false,
            ajax: "{{ route('students.list') }}",
            scrollY: 200,
            scroller: {
                loadingIndicator: true
            },
        } );
    

    Kevin

Sign In or Register to comment.