Nandha
Nandha

Reputation: 693

datatables js speed up?

i am loading more than 10000 records in a datatables in client side, it takes more time for binding all records so i did the following two steps

1. first loaded 100 records in datatables using fnAddData() and fnDraw().
2. remaining records loaded to datatables in settimeout function.

Time taken to load first 100 records is very speed, Eventhough i loaded rest records using settimeout function i face the following issues

 Page goes to not responding until the records bind to datatables 

Any idea how to solve the page not responding issue, i need to load data quickly either full records at a time or first some records later rest using settimeout.

Upvotes: 0

Views: 2630

Answers (2)

Julian Dano
Julian Dano

Reputation: 26

Consider using pagination. This will only render X number of records into the DOM at once and allow you iterate over pages to view the remaining records. Since 99% of your records won't need to be rendered into the DOM to start, this should speed up the loading speed.

$('#example').DataTable({
    dom: 'lrtip',
    paging: true,
    pageLength: 50,
});

Upvotes: 0

You should consider using the server-side options that DataTables provides.

$(document).ready(function() {
    $('#example').dataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": "../server_side/scripts/server_processing.php"
    } );
} );

Upvotes: 2

Related Questions