Topic: modify language in table pagination

juanortizcx free asked 4 years ago


Hi, I'm trying to change the language of my Data Table Pagination but there is not examples in the documentation (I need spanish)

HTML code:

< table id="dtAlumnosGrid" class="table table-hover table-striped table-sm" cellspacing="0" width="100%">

JS CODE: $(document).ready(function() { $('#dtAlumnosGrid').DataTable(); $('.dataTables_length').addClass('bs-select'); });


Krzysztof Wilk staff answered 4 years ago


Hi!

I think you can use "language" property from Bootstrap. You can read more here: https://datatables.net/reference/option/language

But now i prepared for you sampled script, try to use this :)

$(document).ready(function () {
  $('#dtAlumnosGrid').DataTable({
    columns: [{
        title: "Name (Nombre)"
      },
      {
        title: "Position (Posición)"
      },
      {
        title: "Office (Oficina)"
      },
      {
        title: "Extn."
      },
      {
        title: "Start date (Fecha de inicio)"
      },
      {
        title: "Salary (Salario)"
      }
    ],

    dom: 'Bfrtip',
    select: true,
    buttons: [{
        text: 'Select all',
        action: function () {
          table.rows().select();
        }
      },
      {
        text: 'Select none',
        action: function () {
          table.rows().deselect();
        }
      }
    ],
    "language": {
      "search": "Buscar:",
      "lengthMenu": "Display _MENU_ records per page",
      "zeroRecords": "Nada encontrado - lo siento",
      "info": "Showing page _PAGE_ of _PAGES_",
      "infoEmpty": "No hay registros disponibles.",
      "infoFiltered": "(filtered from _MAX_ total records)",
      "paginate": {
        "next": "Próximo",
        "previous": "Previo"
      },
    }
  });
  $('.dataTables_length').addClass('bs-select');
});

juanortizcx free answered 4 years ago


Thanks!!! It is working very well!!! Realy, thanks a lot!!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.12.0
  • Device: laptop
  • Browser: google chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No