I am currently working on a project, where I display every virtual machines available on Azure. As there is a lot of data, I would like to use deferLoading from DataTable. The thing is, either I use deferLoading with integer value, or array value, in both cases, I don’t know what is the total amount of entries in the database (the database is sometimes updated, and the total amount of entries subject to change).
So I am wondering how could I handle this ?
While waiting to find a solution using deferLoading, I am also trying to change de drawCallback option, to change the function called when clicking the “Next” or “Previous” buttons. So I would only load 25 new entries in the datable, which would replace the data already present in the datatable.
Another way to solve my problem is to use a static table, but I won’t have all the possibilities that a DataTable can offer.
Here is the current JavaScript code :
$('#table').DataTable({
pageLength: 25,
/*
processing: true,
serverSide: true,
deferLoading: [25, x],
*/
drawCallback: function() {
// .off() disables the regular action of #table_<name> button
// so the program will only execute the function we want.
$("#table_next").off().click(function(event) {
showNextVMs();
});
$("#table_previous").off().click(function(event) {
showPreviousVMs();
});
}
});
Do not hesitate to share any advice, I never used DataTables before, I may miss some good practices.