It does not work for me DataTable

-1

Good day, I have a project in php and I have a table that brings data from the database and I have the datatable link, but I get the table with all the records down and do not store them by page. If it makes me responsive, but it's because of boostrap but datatable it does not read it to me. Does anyone know why? Thanks in advance.

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="../library/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="../library/metisMenu/metisMenu.min.css" rel="stylesheet">
    <link href="../css/styles.css" rel="stylesheet">
    <link href="../library/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
    <link href="../library/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <script src="../library/jquery/jquery.min.js" defer=""></script>
    <script src="../library/bootstrap/js/bootstrap.min.js" defer=""></script>
    <script src="../library/metisMenu/metisMenu.min.js" defer=""></script>
    <script src="../library/datatables/js/jquery.dataTables.min.js" defer=""></script>
    <script src="../js/js1.js" defer=""></script>
<script>
       $(document).ready(function () {
            $('#tabla').DataTable({

                "language": {
                    "lengthMenu": "Mostrar _MENU_ registros por pagina",
                    //"info": "Mostrando pagina _PAGE_ de _PAGES_ / Mostrados: _START_ de _END_ ",
                    "sInfo": "Mostrando: _START_ de _END_ - Total registros: _TOTAL_ ",
                    "infoEmpty": "No hay registros disponibles",
                    "infoFiltered": "(filtrada de _MAX_ registros)",
                    "loadingRecords": "Cargando...",
                    "processing": "Procesando...",
                    "search": "Buscar:",
                    "zeroRecords": "No se encontraron registros coincidentes",
                    "paginate": {
                        "next": "Siguiente",
                        "previous": "Anterior"
                    }
                }
            });
        });
    </script>
</head>
    
asked by Kygo 24.01.2018 в 03:09
source

2 answers

0

They did not work for me because I had a defer in the DataTable script it seems to put a problem with the DataTable script, Thanks for your help.

    
answered by 29.01.2018 / 16:35
source
0

Question. Any of these links are from the .js of the dataTable?

<script src="../library/jquery/jquery.min.js" defer=""></script>
<script src="../js/js1.js" defer=""></script>

If not, then you should add the dataTable.js and reference it. I also do not see the dataTable script, something like that.

<script>
$(document).ready(function(){
    $('#myTable').DataTable({  
                         
    "language": {
    "lengthMenu": "Mostrar _MENU_ registros por pagina",
      //"info": "Mostrando pagina _PAGE_ de _PAGES_ / Mostrados: _START_ de _END_ ",
    "sInfo": "Mostrando: _START_ de _END_ - Total registros: _TOTAL_ ",
    "infoEmpty": "No hay registros disponibles",
    "infoFiltered": "(filtrada de _MAX_ registros)",
    "loadingRecords": "Cargando...",
    "processing": "Procesando...",
    "search": "Buscar:",
    "zeroRecords": "No se encontraron registros coincidentes",
    "paginate": {
    "next": "Siguiente",
    "previous": "Anterior"
  },
}
});
});
</script>

Where '#myTable' is the name of your table.

I hope my contribution will be of help and solution to your problem.

    
answered by 24.01.2018 в 03:44