Data Table 'flashing' when browser refreshes
Data Table 'flashing' when browser refreshes
Hi - I'm new to using datatables.net, I have a datatable on the home page of my site, www.caliweedjobs.com, and it works well, although I recently upgraded to the latest min CDN files, and added a couple arguments in the Javascript and now everytime I'm viewing the data table and refresh it, it flashes quickly, then jumps back to normal. Maybe it's just re-sorting slowly? Please visit the site and see for yourself. Any advice is very much appreciated, thank you.
<script>
$(document).ready( function() {
$('#datatables0').DataTable({
"order": [ 4, 'desc' ],
"pageLength": 20,
scrollCollapse:true,
"scrollX": true
});
});
</script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.18/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.18/datatables.min.js"></script>
This question has an accepted answers - jump to answer
Answers
Hi @Caliweedjobs ,
It's probably because the
pageLength
setting isn't within the supported lengths as defined bylengthMenu
. Try setting it to25
(which is in the default length list), or customiselengthMenu
to include20
.Cheers,
Colin
thanks @colin, removing pagelength basically doubles the speed, adding lengthmenu undoes some of that benefit, so I'm just not including either for the time being