Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
How to use deferLoading if we don't know the total amount of entries in the database?

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.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As suggested by @cheesyMan, I posted my answer on DataTables Forums. Here is the link to the answer.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda