DataTables button features not showing (Excel, CSV, etc.)

DataTables button features not showing (Excel, CSV, etc.)

ttatarynttataryn Posts: 11Questions: 3Answers: 0
edited September 2018 in Free community support

Making a simple call to the buttons feature using HTML5, and have tried numerous different things, but none have worked.

I've read numerous difference stack overfow and discussions on this and it looks like order matters. Here is what I have loaded for JS and DataTables.

    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    <link rel="stylesheet" href="//cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css">
<script src="//cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"> </script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js"></script>

And the call to DataTables

$(document).ready(function() {
      $('.dataframe').append('<caption style="caption-side: top">After filtering all elements</caption>');
    //   $('.dataframe').append('<button value="Export report to Excel" class="button-default datatable-csv" type="button" id="ExportReporttoExcel">');
    $('.dataframe').DataTable(
      {
        dom: 'Bfrtip',
        text: 'Export',
        buttons: ['excelHtml5','csvHtml5']

});
});

My table comes from a dataframe using Python and Flask, and DataTables overall is working. However the Excel, CSV, or any button for that matter simply doesn't show up. With the above code, I currenlty have no errors but the buttons still do not show up. Please help. Thanks.

EDIT: Also, other info: I have a Mac and have tried using Chrome, Safari, and Firefox and no change in success.

This question has an accepted answers - jump to answer

Answers

  • ttatarynttataryn Posts: 11Questions: 3Answers: 0

    Also, I've tried downloading the content and sourcing it locally, as well as downloading the CDN package that is provided by DataTables. Still didn't work.

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Your Datatables init code and the CSS and JS includes (the same order you listed above) work here:
    http://live.datatables.net/becacada/1/edit

    The text: 'Export' is not doing anything. This is the buttons.buttons.text that you would put within the buttons config.

    The buttons not showing is something specific to your environment. Are you getting any errors in your browser's console?

    Can you post a link to your page for troubleshooting?

    Kevin

  • ttatarynttataryn Posts: 11Questions: 3Answers: 0

    Kevin,

    Thanks for the response and link. I've tried re-copying and pasting that same code into my program and got the same results, while even using the example manual table. What may be an issue here is that I am using python flask (a framework that allows me to render HTML templates via Python code) to render HTML pages. I basically have a dataframe and convert that to HTML and then with Javascript make it a DataTable. The DataTable portion actually works, but the buttons aren't showing up. Not sure why -- it makes zero sense. I have tried using multiple different versions in terms of the CDN's to no avail. I am using Chrome and Mac OS High Sierra, however have also tried using Firefox and Safari with the same result.

    I unfortunately can't post a link to my page, however the code i've provided above is essentially what is rendering the DataTable so not sure if it would be useful to provide more...

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @ttataryn ,

    As Kevin said, a link to your page, or a test case, would help massively to progress this one,

    Cheers,

    Colin

This discussion has been closed.