Reputation: 11
I used the code below to change the default option of jQuery DataTables to show 12,24,36,48 records per page instead of the default 10,25,50,100 records.
$(document).ready( function() {
$('#example').dataTable( {
"pageLength": 12
} );
} )
Is there a way I can display the dropdown option text as "12 cell phones, 24 cell phones, 36 cell phones, 48 cell phones"?
Upvotes: 1
Views: 855
Reputation: 1171
The option you are looking for is "aLengthMenu". You can achieve this as:
$(document).ready( function(){
$('#table').dataTable({
"aLengthMenu": [[12, 24, 36, 48], ["12 Cell Phones Per Page", "24 Cell Phones Per Page", "36 Cell Phones Per Page", "48 Cell Phones Per Page"]]
});
});
Upvotes: 1