Excel export button

Excel export button

droshidroshi Posts: 10Questions: 2Answers: 1
edited October 2016 in Free community support

I've changed the topic based on my actual problem, other display problems are fixed.

Buttons, for some reason, all of them work except 'excel' isn't being displayed in Chrome. I've tried the HTML5 forcing as well, and still nothing. Any ideas? CSV works great.

dtEquip = $('#EquipmentGrid').DataTable({
     dom: '<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-tl ui-corner-tr"frlipB>' +
         't' +
         '<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-bl ui-corner-br"lip>',
     autoWidth: false,
     processing: true,
     stateSave: true,
     colReorder: true,
     scrollX: true,
     buttons: [
         'csv', 'excel', 'pdf', 'colvis'
     ],
     lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
     order: [[14, 'desc']],
     columnDefs: [
         { targets: [0, 1, 16], "width": "50px"}
     ],
     ajax: {
         "url": "/ajax/data.asmx/getTable"
     }
 });

This question has an accepted answers - jump to answer

Answers

  • KW802KW802 Posts: 7Questions: 1Answers: 1
    Answer ✓

    Do you have all of the JS files needed? The Excel functionality requires "jszip.js" to be loaded.

    You can see an example here https://datatables.net/extensions/buttons/examples/html5/simple.html and below the example you can grab the current versions of the files.

  • droshidroshi Posts: 10Questions: 2Answers: 1

    No I didn't realize that the Excel functionality was part of the "zip" library, I figured that was for something else! Thanks for the help.

  • allanallan Posts: 61,450Questions: 1Answers: 10,055 Site admin

    An XLSX file is really just a collection of XML files which are zipped together. The Buttons export uses the excellent JSZip library to do that zip and make a valid XLSX file.

    Allan

This discussion has been closed.