I removed lfrom my property sDomwhen declaring the first instance of my datatable.
Then I added this immediately before the tag <table>in my code:
<div class="selectLength">
<span>Show</span>
<select id="Length">
<option value='5'>5</option>
<option value='10'>10</option>
<option value='25'>25</option>
<option value='50'>50</option>
</select>
<span>elements in the datatable.</span>
</div>
Here is the javascript ( jQuery ) related to this :
$('#Length').change(function() {
var displayLength = $('#Length option:selected').val();
var oSettings = $('.adminTable').dataTable().fnSettings();
oSettings.iDisplayLength = displayLength;
$('.adminTable').dataTable().fnDraw();
});
source
share