0
votes

In datatables instead of fetching all records at a time ,want to display first 20 records and on clicking next i have to show next 20 records using ajax .Will some one of u pls help to solve this problem with examples. I have searched but i dont get the enough data.

$('#example').dataTable( {
    "processing": true,
    "serverSide": true,
    "iDisplayLength":20,
   });

Also i have used this

var oTable;
    $('.paginate_enabled_next').click( function () 
    {
    oTable.fnSetDisplayLength = 2;
    oTable.fnDraw();
    });

oTable = $('#example').dataTable();

Apart from this will any one of u explain where i have to change.

1

1 Answers

0
votes

You need to provide ajax url from where the data will be fetched and displayed. If you have tried using Ajax please add you server side code, would be able to help you getting the pagination done The below link will help you get it done. https://www.datatables.net/examples/data_sources/server_side.html