Load slow with amount of data
cgriobo opened this issue · 1 comments
Hi Ruhid!
First of all, excelent work with this CRUD! Realy simple and usefull.
I have a problem when managed amount of data (around 2000 rows), it works really slowly when load. I read the documentation of datatables and can`t find a solution. Is not a really large table, this amount of rows.
I tryed too, with your original repo, and have the same behaviour. Do you have some idea about reason of that??
Thanks in advance. Carlos.
Hi!
I solved that. Change a call to a datatable library, in the "fetchdata" function, and works well with a large amount of data.
// function to fetch data from db and intialize datatable
function fetchData() {
$.ajax({
url: 'server.php?action=fetchData',
type: 'GET',
dataType: 'json',
success: function(data) {
// Handle the received data and update the DataTable
if (data.length > 0) {
table = $('#myTable').DataTable({
data: data,
columns: [
{ data: 'id' },
{ data: 'last_name' },
// all columns that you need...
],
dom: 'Bfrtip',
// rest of settings of datatables that you need
responsive: true
});
} else {
$('#myTable tbody').append('No hay datos disponibles en la DB');
}
},
error: function(error) {
console.log('Error:', error);
}
});
}
Thanks!