Simple question about button page lenght

Simple question about button page lenght

E_BrandaoE_Brandao Posts: 12Questions: 5Answers: 0

My table has 1535 rows and showing all properly, but in the button pageLength the text presented is "Showing -1 lines" because when i want all lines i send the value -1 to the server side script. I want to know how i put the text "Showing 1535 lines" in the button

  $(document).ready(function(){
    $('.table-log-notas').DataTable({
        "serverSide": true,
        "ajax": {
          "url": "../assets/php/functions/tabela-notas.php",
          "type": "POST"
        },
        responsive: true,
        "pageLength": -1,
        dom: 'Bfrtip',
        lengthMenu: [
            [ 10, 50, 100, -1 ],
            [ '10 linhas', '50 linhas', '100 linhas', 'Todas as linhas' ]
        ],
        buttons: [
            'excel', 'pdf','pageLength'
        ],
      //Definição dos textos que aparecerão na tabela
      "language": {
        "lengthMenu": "Mostrando _MENU_ registros por página",
        "zeroRecords": "Nada encontrado",
        "info": "Mostrando página _PAGE_ de _PAGES_",
        "infoEmpty": "Nenhum registro disponível",
        "infoFiltered": "(filtrado de _MAX_ registros no total)",
        "sSearch": "Pesquisar",
        "oPaginate": {
          "sNext": "Próximo",
          "sPrevious": "Anterior",
          "sFirst": "Primeiro",
          "sLast": "Último"
        },
        buttons: {
            pageLength: {
                _: "Showing %d lines"
            }
        }
      },
    });
  });

This question has an accepted answers - jump to answer

Answers

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

    Isn't this the same question as your other thread?

    Colin

  • E_BrandaoE_Brandao Posts: 12Questions: 5Answers: 0
    edited June 2020

    No in the other question the script was not showing the table, now it is working, i just need to put the number of rows in the text of the buttton. Replace that "mostrando -1" to "mostrando 1535"

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923
    edited June 2020 Answer ✓

    The last example in the docs should be what you need:
    https://datatables.net/reference/button/pageLength

    Kevin

  • E_BrandaoE_Brandao Posts: 12Questions: 5Answers: 0

    Thank you, it is working properly!

This discussion has been closed.