'excelHtml5' and 'csvHtml5' buttons are not working !

'excelHtml5' and 'csvHtml5' buttons are not working !

PuneetPuneet Posts: 6Questions: 3Answers: 0

Hi,
I was trying to import datatable to excel file using HTML5 buttons but failed(I tried with 'excelFlash' and 'excel' buttons too). It is giving me exception as "Uncaught TypeError: Cannot read property 'replace' of null" in "buttons.html5.min.js". I have included all the required lib files which mentioned here : https://datatables.net/extensions/buttons/examples/initialisation/export.html. My datatable definition is :

table = $(".jqueryDataTable").DataTable( {          
                        "searching": false,
                    "retrieve": true, 
                    "destroy": true,
                    "ajax": "./getReportDetails",
                    "jQueryUI": true,
                    "dom": 'Bfr<"H"lf><"datatable-scroll"t><"F"ip>',
                    buttons: [
                               'copyHtml5',      //buttons for export
                              'excelHtml5',
                              'csvHtml5',
                              'pdfFlash'
                          ],
                    "fnServerParams": function ( data ) {
                        newData=data;
                        newData.push( { "name": "reportType", "value": reportType }, { "name": "reportSubType", "value": reportSubType}, { "name": "fromDate", "value": fromDate}, { "name": "toDate", "value": toDate});
                    },
                    "columns": [
                                    { "mData": "username", "sTitle": "username"},
                                    { "mData": "transferType", "sTitle": "transferType"},
                                    { "mData": "fromAccount", "sTitle": "fromAccount"},
                                    { "mData": "toAccount", "sTitle": "toAccount"},
                                    { "mData": "amount", "sTitle": "amount"},
                                    { "mData": "currency", "sTitle": "currency"},
                                    { "mData": "transferDate", "sTitle": "transferDate"},
                                    { "mData": "creditDebitFlag", "sTitle": "creditDebitFlag"},
                                    { "mData": "fromAccountType", "sTitle": "fromAccountType"},
                                    { "mData": "toAccountType", "sTitle": "toAccountType"},
                                    { "mData": "impsChannelType", "sTitle": "impsChannelType"},
                                    { "mData": "impsTranType", "sTitle": "impsTranType"},
                                    { "mData": "IFSCCode", "sTitle": "IFSCCode"},
                                    { "mData": "narration", "sTitle": "narration"},
                                    { "mData": "customerID", "sTitle": "customerID"},
                                    { "mData": "customerName", "sTitle": "customerName"},
                                    { "mData": "fromMMID", "sTitle": "fromMMID"},
                                    { "mData": "fromMobileNo", "sTitle": "fromMobileNo"},
                                    { "mData": "toMMID", "sTitle": "toMMID"},
                                    { "mData": "toMobileNo", "sTitle": "toMobileNo"},
                                    { "mData": "paymentType", "sTitle": "paymentType"},
                                    { "mData": "transReferenceId", "sTitle": "transReferenceId"},
                                    { "mData": "transactionStatus", "sTitle": "transactionStatus"}
                        ]
                } ); 

Please let me know about what is issue with other pdf buttons and how to generate formatted pdf file ?

This discussion has been closed.