HTML5 Export Buttons File Name Change

HTML5 Export Buttons File Name Change

clayleatherwoodclayleatherwood Posts: 2Questions: 1Answers: 0
edited August 2016 in Free community support

How can I change the name of the file that gets exported? I noticed in your example you have "DataTables example - HTML5 export buttons.xlsx" (or whatever extension). Where in the code do you go to put a different name in?

Here is the example I'm referring to: https://datatables.net/extensions/buttons/examples/html5/simple.html

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin
    Answer ✓

    Use the filename option - excelHtml5.

    Allan

  • clayleatherwoodclayleatherwood Posts: 2Questions: 1Answers: 0

    Thank you so much Allan! That was an amazing help.

    Here's the code I use to change the filename in the file exporting if this ends up helping anyone in the future:

    $(document).ready(function() {
    $('#example').DataTable( {
    dom: 'Bfrtip',
    buttons: [
    {
    extend: 'csv',
    filename: 'pin_change_export'
    },
    {
    extend: 'excel',
    filename: 'pin_change_export'
    }
    ]
    } );
    } );

This discussion has been closed.