clarketm / TableExport

The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
https://tableexport.travismclarke.com/
Apache License 2.0
888 stars 289 forks source link

Bootstrap HTML Table Export using TableExport.js not working #128

Open HussainMD opened 6 years ago

HussainMD commented 6 years ago

Hi,

Can someone help me with this issue?

https://stackoverflow.com/questions/49552267/bootstrap-html-table-export-using-tableexport-js-not-working

Thank you in advance.

HussainMD commented 6 years ago

I am getting below error:

tableexport.min.js:19 Uncaught TypeError: n is not a function at Object.export2file (tableexport.min.js:19) at HTMLButtonElement. (tableexport.min.js:19) at HTMLButtonElement.dispatch (jquery-3.3.1.js:5183) at HTMLButtonElement.elemData.handle (jquery-3.3.1.js:4991) jquery.dataTables.min.js:96 [Violation] 'setTimeout' handler took 79ms jquery.dataTables.min.js:96 [Violation] 'setTimeout' handler took 51ms

after I changed the call to tableexport to below:

<button tableexport-id="78cbc47-txt" class="btn btn-default txt" onClick="return ResultsToTable()">Export to txt</button>

<script type="text/javascript">
    function ResultsToTable(){
            $("#dataTablesEx").tableExport();};
 </script>



HussainMD commented 6 years ago

I was including both tableexport.js and tableexport.min.js in HTML code. Commented out tableexport.min.js and now I am getting below error. Can someone help with this?

tableexport.js:584 Uncaught TypeError: saveAs is not a function
    at Object.export2file (tableexport.js:584)
    at HTMLButtonElement.<anonymous> (tableexport.js:319)
    at HTMLButtonElement.dispatch (jquery-3.3.1.js:5183)
    at HTMLButtonElement.elemData.handle (jquery-3.3.1.js:4991)
HussainMD commented 6 years ago

Guys, I had incorrect order of javascripts which was causing above error. Now I've another issue where by when I click on the "Export to xls" or "Export to csv" or "Export to txt" buttons it renders duplicate button. and when I click on duplicate button it triggers the tableexport and saves the file.

image

XLS file has no data in the file. while CSV and TXT files has only first page of the table and doesnt take into account HTML pagination. Any idea why this is happening?