Excel button is not showing

Excel button is not showing

sosososososo Posts: 2Questions: 1Answers: 0

Hi
I tried DataTables in my web.
And I want export to excel button.
Below is my code.

CSS
<link rel="stylesheet" type="text/css" href="/css/datatables/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">

JS

<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js"></script>

var info_table = $('#info').DataTable({
        'dom': 'Bfrtip',
        'buttons': [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ],
        'ajax' : {
            "type" : "POST",
            "url" : './info',
            "beforeSend" : function() {
                $(".loading").show();
            },
            "complete" : function() {
                $('.loading').hide();
            },
            "data" : function(d) {
                d.start_date = $('#start-datepicker').val();
                d.end_date = $('#end-datepicker').val();
            },
            "dataSrc" : "",
        },
        'columns' : [ {
            "data" : "date"
        }, {
            "data" : "username"
        }, {
            "data" : "logintime"
        } ]
    });

The problem is, the data on the table populated correctly.
But the buttons are not visible.
Please help me on this...

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Looks like you've got everything needed there. Can you link to a test page showing the issue so we can help to debug it please?

    Allan

  • sosososososo Posts: 2Questions: 1Answers: 0

    It's working!

This discussion has been closed.