I am using JQuery Datatable: 1.10.7 and https://datatables.net/reference/option/lengthMenu
JS code:
$('.table').dataTable({
'lengthMenu': [ [10, 25, 50, -1], [10, 25, 50, 'All'] ],
'aoColumns': [null, null, null, { 'bSortable': false }, { 'bSortable': false }] }); // eslint-disable-line new-cap
Output:

But I need the following list to set page length:

How to do? Anything missing?
UPDATE
Output html:
<div id="DataTables_Table_0_length" class="dataTables_length">
<label>
Show
<select class="" aria-controls="DataTables_Table_0" name="DataTables_Table_0_length">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="-1">All</option>
</select>
entries
</label>
</div>
But it is not shown at all.
UPDATE
The reason is:
.dataTables_length {
display: none;
}
Show details. Number of rows to display on a single page when using pagination. If feature enabled (bLengthChange) then the end user will be able to override this to a custom setting using a pop-up menu.
len() method can still be used if you wish to programmatically change the page size and pageLength can be used to specify the initial page length.
There is a option called pageLength . You can set this for show only 5 entries.
Use the below dom value,
dom: 'Blfrtip',
You might be using Bfrtip as dom value. Try using Blfrtip. It will show Export buttons as well length menu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With