massiv performance issues after switching "show xx entries" using ajax sourced data
massiv performance issues after switching "show xx entries" using ajax sourced data
i'm using Datatables v1.9 with ajax sourced data (generating via php) which generates ~700 rows.
before modifying the options for "show xx entries" i could smooth switch between e.g. 10 entries per page (epp) and 100 epp. after adding the options for all entries i realized a massiv issue, when i switch from 10 epp to 50, 100 or all epp there is no lag, but then i switch from all to 100,50, or 10 epp there is a big lag, the browser-tab freezes and it takes some seconds to continue. the with ~700 entries it took 9 seconds to switch from all epp to 10 epp
my js is this:
$(document).ready(function() {
$('#devices').DataTable( {
"processing": true,
"ajax": {
'type': 'POST',
'url': 'inc/get_devices.php',
'dataSrc': 'data'
},
'deferRender': true,
'lengthMenu': [ [10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, 'All'] ],
initComplete: function () {
this.api().columns('.select-filter').every( function () {
var column = this;
var select = $('<select class="form-control"><option value="">all</option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
} );
} );
This question has an accepted answers - jump to answer
Answers
Per the forum rules, please link to a test case showing the issue.
Allan
while building a testcase i found out, its not a datatable problem, it seems to a problem on my hole website...
in the testcase-build with bootstrap and datatables it works fine, but in my website there is the issue with the freeze.. i need to review my code
thats awkward :-(
it was a freaking browser-plugin (Kaspersky Protection) which caused the issue..
Heh - so it goes. Good to hear you got it sorted out!
Allan