rodzy03 / iwasto

0 stars 0 forks source link

Add Export Tools on all table #36

Closed zheuswalker closed 3 years ago

zheuswalker commented 3 years ago

Insert this before

Document Ready javascript


 $(document).ready(function () {
        var table = $('#namengtable').DataTable({
            buttons: [
                'print',
                'copyHtml5',
                'excelHtml5',
                'csvHtml5',
                'pdfHtml5',
            ],
            processing: true,
            responsive: true,
            "order": [[1, "asc"]]
        });
        $('#export_print').on('click', function (e) {
            e.preventDefault();
            table.button(0).trigger();
        });

        $('#export_copy').on('click', function (e) {
            e.preventDefault();
            table.button(1).trigger();
        });

        $('#export_excel').on('click', function (e) {
            e.preventDefault();
            table.button(2).trigger();
        });

        $('#export_csv').on('click', function (e) {
            e.preventDefault();
            table.button(3).trigger();
        });

        $('#export_pdf').on('click', function (e) {
            e.preventDefault();
            table.button(4).trigger();
        });
    });