Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda