lengthMenu

lengthMenu

nicocandelanicocandela Posts: 3Questions: 1Answers: 0

Why "lengthMenu": [ 10, 25, 50, 75, 100 ] and "lengthMenu": " MENU registros"

If I put "lengthMenu": " MENU registros" the table works but if I use "lengthMenu": [ 10, 25, 50, 75, 100 ] the table dont show search field and number of rows selector.
Also, I try
"language": {
"lengthMenu": " MENU registros"
},

But don´t work

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Can you post your entire DataTables initialisation please - I'm not really understanding.

    Allan

  • nicocandelanicocandela Posts: 3Questions: 1Answers: 0
    $(document).ready(function () {
        var table = $('table.table').DataTable({
            language: {
                "decimal":        "",
                "emptyTable":     "No hay datos",
                "info":           "Mostrando _START_ a _END_ de _TOTAL_ registros",
                "infoEmpty":      "Mostrando 0 de 0 de 0 registros",
                "infoFiltered":   "(filtrado para _MAX_ total de registros)",
                "infoPostFix":    "",
                "thousands":      ",",
                "lengthMenu":     " _MENU_ registros",
                "loadingRecords": "Cargando...",
                "processing":     "Procesando...",
                "search":         "Buscar:",
                "zeroRecords":    "No se han encontrado registros",
                "paginate": {
                    "first":      "Primero",
                    "last":       "Ultimo",
                    "next":       "Siguiente",
                    "previous":   "Anterior"
                },
                "aria": {
                    "sortAscending":  ": activar para ordenar la columna ascendentemente",
                    "sortDescending": ": activar para ordenar la columna descendentemente"
                },
                "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "Todos"] ],
                "pageLength": 50
    
            },
    

    Whith this options , don´t show search field and number of rows selector.
    If I delete de lines
    "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "Todos"] ],
    "pageLength": 50
    works fine.

    But I want show 50 rows by page and the option of All (-1)

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "Todos"] ],

    You have put that line inside your "language" settings. It should be outside, as a separate item.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Good spot, @tangerine , the same for pageLength too..

  • nicocandelanicocandela Posts: 3Questions: 1Answers: 0

    ok, thanks, now I see it

This discussion has been closed.