lengthMenu help me.

lengthMenu help me.

Carlos210484Carlos210484 Posts: 3Questions: 1Answers: 0

changing the parameters of lengthMenu, it shows only 4 rows, and I am writing to show me 5 rows where am I wrong? but if ordered by descending if it shows 5 rows.

        "order": [[0, 'asc']],

        "lengthMenu": [[5, 15, 20, -1],[5, 15, 20, "Todo"]],
        "pageLength": 10,

Answers

  • Tom (DataTables)Tom (DataTables) Posts: 139Questions: 0Answers: 26
    edited July 2016

    Its because you've set pageLength to be set to 10 but you haven't defined 10 as an option inside lengthMenu either add 10 to the array inside lengthMenu or change pageLength to be 5.

    Thanks

    Tom

  • Carlos210484Carlos210484 Posts: 3Questions: 1Answers: 0

    Thanks Tom , change the values ​​of lengthMenu to 5 and pageLength to 5​​, but still shows me only 4 rows . imagens attached . Attached image

    "order": [ [0, 'asc'] ],

    "lengthMenu": [ [5, 10, 20, -1], [5, 10, 20, "Todo"] ],

    "pageLength": 5,

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Are you using server-side processing? It sounds like the server-side might only be returning four rows.

    If you give a link to the page we'd be happy to take a look at it.

    Allan

  • Carlos210484Carlos210484 Posts: 3Questions: 1Answers: 0
    edited July 2016

    I check the server side , and if you send the correct rows.

    the problem is " TOTAL " on line 9. because it brings me 16 rows , and my board have only 15 rows . but I can not find from where it takes 16 rows. Attached image.

        var oTable = table.dataTable({
    
            "language": {
                "aria": {
                    "sortAscending": ": activate to sort column ascending",
                    "sortDescending": ": activate to sort column descending"
                },
                "emptyTable": "No hay datos para mostrar",
                "info": "Mostrando _START_ a _END_ de _TOTAL_ registros",
                "infoEmpty": "No se encontraron datos",
                "infoFiltered": "(filtrado de _MAX_ registros)",
                "lengthMenu": "Mostrar _MENU_ ",
                "search": "Buscar:",
                "zeroRecords": "No se encontraron coincidencias"
            },
    
            // Or you can use remote translation file
            //"language": {
            //   url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
            //},
    
            "order": [
                [0,'asc']
            ],
    
            "lengthMenu": [
                [5, 10, 20, -1],
                [5, 10, 20, "Todo"] // change per page values here
            ],
            // set the initial value
            "pageLength": 10,
    
  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    I would need a link to the page showing the issue to be able to debug the issue, as I requested above.

    Allan

This discussion has been closed.