Use the datatables buttons?

0

I want to add the button to export to Excel with DataTables, but it generates the following error Uncaught TypeError: $(...).DataTable is not a function as I investigate the error is due to load the datatables script first before the jquery script, but even after changing the order it follows the same mistake.

my view code is as follows:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script>
$(document).ready(function(){
$('#tabla_operaciones').DataTable({
    dom: 'Bfrtipo',
    processing: true,
    serverSide: true,
    pageLength: 50,
    ajax:{
        url: 'listado_operaciones',
        dataSrc: 'data',
    },
    buttons: [
            'excel'
                                  ],
    columns: [
        { data: 'id', name: 'id'},
        { data: 'name', name:  'users.name'},
        { data: 'noboleta', name: 'noboleta' },
        { data: 'tipo', name: 'tipos.tipo'},
        { data: 'nombre', name: 'bancos.nombre'},
        { data: 'monto', name: 'monto'},
        { data: 'created_at', name: 'created_at'},
        { data: 'updated_at', name: 'updated_at'},
        { data: 'estado', name: 'estados.estado'},
        { data: 'autorizacion', name: 'autorizacion'},
            ]
});
    });
    </script>
    
asked by user93672 11.07.2018 в 17:43
source

0 answers