Add number of rows in Table Javascript

There are number of plugins of Javascript that can export table data. Take the example of this. Can I add dropdown value to select number of rows in every page? In default setting there are 10 rows/page. I want to increase this to 20. I tried several options but couldn't make it.

Something has to be added on this

 $(document).ready(function() {
       $('#example').DataTable( {
           dom: 'Bfrtip',
           buttons: [
               'copy', 'csv', 'excel', 'pdf', 'print'
           ]
       } );
   } );

Upvotes: 0

Views: 88

Answers (2)

Code Developer
Code Developer

Reputation: 26

Continuation to Rio answer.

$(document).ready(function() {
       $('#example').DataTable( {
           dom: 'Bfrtip',
           "pageLength": 50,
           buttons: [
               'copy', 'csv', 'excel', 'pdf', 'print', 'pageLength'
           ]
       } );
   } );

Upvotes: 1

Rio Weber
Rio Weber

Reputation: 3143

The example in documentation is here
https://datatables.net/reference/option/pageLength

$('#example').dataTable( {
  "pageLength": 50
} );

Upvotes: 1

Related Questions