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

92
Vistas
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 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