i am trying to change pagination size of table
the default is 10,25,50,100 but i want to change it to 15, 30, 50, all
in my table i use pagination and search in footer here my code
<script type="text/javascript">
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#example tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="' title '" />' );
} );
// DataTable
var table = $('#example').DataTable({
initComplete: function () {
// Apply the search
this.api().columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change clear', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
}
});
} );
</script>
how to change the entries size by 15,30, 50, and all
CodePudding user response:
just use lengthMenu configuration to set custom page sizes
var table = $("#example").DataTable({
lengthMenu: [[15, 30, 50, 100], [15, 30, 50, 100]],
initComplete: function () {
...
} );
});
CodePudding user response:
[...Array(countPages).keys()].map(num => <button key={num}
className={page === num ? "selected" : ""} onClick={() => setPage(num)}>{num 1})