Datatables buttons 'copyHtml5' error

Datatables buttons 'copyHtml5' error

guilhermewguilhermew Posts: 1Questions: 1Answers: 0

Hi guys! Someone can help me with the buttons plugin? I spent some time studding this data tables and now, i need export the table for excel/pdf..
I followed the steps:
* Build a version with plugins.
Insert this code on dataTables inicialization:

   $('#' + this.tableId).dataTable({
        buttons: [
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ],

        data: this.lines,
        columns: this.headers,
        pagingType: 'full_numbers'


    });

When i run this code, the error message is shown: datatables.1.10.8.min.js:92485 Uncaught TypeError: Cannot set property 'copyHtml5' of undefined (this line is not from minified file) Someone can help me? I appreciate!

Answers

  • allanallan Posts: 63,258Questions: 1Answers: 10,421 Site admin

    Hi,

    I don't immediately see any issue with your code there. Can you link to the page showing the issue so I can debug it please.

    Allan

  • lac616lac616 Posts: 4Questions: 1Answers: 0

    I'm having a similar problem. I'm getting 'Unknown button type: copyHtml5'. This is my code:

    oData = $('#tblReportData').DataTable({
                        pageLength: 50,
                        processing: true,
                        searching: false,
                        autoWidth: false,
                        lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
                        dom: 'T<"clear">lfrtip',
                        order: [[0, "desc"]],
                        buttons: [
                            'copyHtml5',
                            'excelHtml5',
                            'csvHtml5',
                            'pdfHtml5'
                        ]
                    });
    

    Failing in dataTables.buttons.js version 1.0.3

  • allanallan Posts: 63,258Questions: 1Answers: 10,421 Site admin

    Have you included the HTML5 export buttons file?

    Allan

  • covaithecovaithe Posts: 1Questions: 0Answers: 0

    I was seeing this error "TypeError: Cannot set property 'copyHtml5' of undefined" when using dataTables 1.10.3. DataTables.ext.buttons appears to be undefined prior to 1.10.5. Upgrading jquery.dataTables (to 1.10.7 in my case) fixed this for me.

  • allanallan Posts: 63,258Questions: 1Answers: 10,421 Site admin

    This is correct - Buttons requires a relatively modern version of DataTables.

    Allan

This discussion has been closed.