TableExport icon indicating copy to clipboard operation
TableExport copied to clipboard

Bootstrap HTML Table Export using TableExport.js not working

Open HussainMD opened this issue 7 years ago • 3 comments

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 avatar Mar 29 '18 10:03 HussainMD

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 avatar Mar 29 '18 15:03 HussainMD

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 avatar Mar 30 '18 09:03 HussainMD

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?

HussainMD avatar Apr 04 '18 08:04 HussainMD