detj detj - 6 months ago 14
Javascript Question

How to change results per page value in datatables

Datatables has an option to select the number of records shown per page. The default value starts from 10, 25, 50 and 100. How can I change it to start from 5 instead of 10?
10 records is a bit too much and takes a lot of space in my current design.
Thanx!

http://datatables.net/

Answer

You will want to use the iDisplayLength parameter when you initialize the DataTable object. Here's the example they list in their documentation:

$(document).ready( function() {
    $('#example').dataTable( {
        "iDisplayLength": 50
    } );
} )

More information can be found here: http://www.datatables.net/usage/options

Comments