Topic: MDB table component pagination initial page size
I am using the Datatable component with Table pagination.
I would like to change the default page size to 25. I have tried :
$(document).ready(function () {
$('#dtBasicExample').DataTable({
"ordering": false
});
$('.dataTables_length').addClass('bs-select');
$('select[name ="dtBasicExample_length"]').val("25");
});
but while that sets the dropdown it does not change the page size.
Is there an option like?
$('#dtBasicExample').DataTable({
"ordering": false,
"pagingSize" : 25
});
Mateusz Łubianka staff answered 5 years ago
Hi @joel2,
Try to use this code:
<!-- Your custom scripts (optional) -->
<script type="text/javascript">
$(document).ready(function () {
$('#dtBasicExample').DataTable({
"pageLength": 50
});
$('.dataTables_length').addClass('bs-select');
});
</script>
I used it and it works fine.
Best,
joel2 commented 5 years ago
Just the ticket Mateusz, works perfectly. Many thanks.
Mateusz Łubianka staff commented 5 years ago
I'm glad I could help.
Best,
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.11.0
- Device: Laptop
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No