dataTables Export to Excel button is not showing

前端 未结 2 461
谎友^
谎友^ 2021-02-11 16:01

I have a problem in jquery dataTables. The \"Export to Excel\" is not showing in iPad and mobile devices. It is showing in desktop. Other buttons like copy, csv and pdf are show

相关标签:
2条回答
  • 2021-02-11 16:20

    Try loading required JS libraries in the following order, if anyone still having issues in showing the DataTable export buttons.

    <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script> 
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
    

    Cheers!

    0 讨论(0)
  • 2021-02-11 16:35

    I know this is super old but since I was using Webpack 4 and Babel and I was importing the files (ES6) I had to put in the global scope the jsZip:

    import 'datatables.net-bs';
    import jsZip from 'jszip';
    import 'datatables.net-buttons-bs';
    import 'datatables.net-buttons/js/buttons.colVis.min';
    import 'datatables.net-buttons/js/dataTables.buttons.min';
    import 'datatables.net-buttons/js/buttons.flash.min';
    import 'datatables.net-buttons/js/buttons.html5.min';
    
    // This line was the one missing
    window.JSZip = jsZip;
    

    Hope it helps Cheers

    0 讨论(0)
提交回复
热议问题