Length Change not working
Length Change not working
![County](https://secure.gravatar.com/avatar/3a2b95f165b7a31fa132231c97d123d4/?default=https%3A%2F%2Fvanillicon.com%2F3a2b95f165b7a31fa132231c97d123d4_200.png&rating=g&size=120)
Hey all, I've read over the documentation regarding the length change, but I simply cannot get it to work with my script below since the length change stays as default. Does anyone know how to fix it please? I would like to only display 10 records per page. If that's not possible, I'd like to disable the length change all together. Thanks!
<script type="text/javascript" charset="utf8">
$(document).ready(function(){
$('#myTable').dataTable( { "sPaginationType": "full_numbers"} );
$("#myTable").css("font-size", 14);
$("myTable").dataTable("lengthChange", 10);
});
</script>
This discussion has been closed.
Answers
lengthChange values are true or false. I suspect you need lengthMenu.
Hi @County ,
As @tangerine says,
lengthChange
is a boolean, you probably wantlengthMenu
.Also, you're initialising the table twice - first on line 4, then again on line 6 - with different options. You're probably getting a console error saying warning against this. Just put all the options for the table in a single initialiser, i.e:
Cheers,
Colin