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

95
Visualizações
JQuery DataTable Page Length Not Being Honored After Page 1

I have a JQuery data table that has a large amount of data. I set the page length, but whenever I go past the first page, it does not honor the the length anymore.

Page 1 Page 2

As you can see, the page length is 50 which honored on the first page, but after that, the length is no longer honored.

This is my script:

dataTable = $("#sampleTable").DataTable({
      "ajax": {
       "url": '....',
      "contentType": "application/json",
      "type": "POST",
      "dataSrc": ""
    },
 "columns": [
          {"data": "name", "title": "Name"},
          {"data": "value", "title": "Value"}
],
     "order": [[1, 'desc']],
     "createdRow": function(tr, _, rowIndex) {
        return $(tr).attr('rowindex', rowIndex)
      },
     "bDestroy": true,
     "pageLength": 50,
     "lengthMenu": [ 10, 15, 20 , 30, 50],
   });

The version I am using is jquery 1.21.1 and datatables 1.10.21

Update: As requested, this is what get's called by the ajax call

    @PostMapping(value = Paths.SAMPLE, consumes = { MediaType.APPLICATION_JSON }, produces = {
            MediaType.APPLICATION_JSON })
    @ResponseBody
    public Collection<SampleData> retrieveSamples() {
        return sampleDBDao.retrieveData();
    }

sample.tag

<table id="sampleTable" class="table" style="width: 100%">
</table>

Is the issue because there is a large amount of data?

about 4 years ago · Juan Pablo Isaza
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