TableTools CSV export only working in Chrome
TableTools CSV export only working in Chrome
pstoller78
Posts: 4Questions: 0Answers: 0
I am having problems with the CSV export feature. It seems to work fine in chrome, but only reloads the page in chrome.
Any advice would be welcomed.
Here is the code I am using.
[code] $(document).ready(function() {
getAssignments(thisUserAccount, currentUserType);
$('#centralDiv').html( "Quality Assgnments for the teams of "+FL+" for the month of "+thisMonth+" " );
$('#assignmentstable').dataTable( {
"bPaginate": false,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
"csv",
"print"
]
},
"aaData": assignedtasks,
"aoColumns": [
{ "mDataProp": "Analyst", "sTitle": "Analyst", "sClass": "center" },
{ "mDataProp": "Supervisor", "sTitle": "Supervisor", "sClass": "center" },
{ "mDataProp": "Workgroup", "sTitle": "Workgroup", "sClass": "center" },
{ "mDataProp": "CompletedReviews", "sTitle": "Completed Reviews", "sClass": "center" },
{ "mDataProp": "ReviewsToBeCompleted", "sTitle": "Reviews To Be Completed", "sClass": "center" },
{ "mDataProp": "AverageForThePeriod", "sTitle": "Average for the Period", "sClass": "center" },
{ "mDataProp": "AssignmentSet", "sTitle": "Assigned Quizes", "sClass": "center" },
{ "mDataProp": "ScorecardLink", "sTitle": "ScorecardLink", "sClass": "center" }
]
} );
} ); [/code]
Any advice would be welcomed.
Here is the code I am using.
[code] $(document).ready(function() {
getAssignments(thisUserAccount, currentUserType);
$('#centralDiv').html( "Quality Assgnments for the teams of "+FL+" for the month of "+thisMonth+" " );
$('#assignmentstable').dataTable( {
"bPaginate": false,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
"csv",
"print"
]
},
"aaData": assignedtasks,
"aoColumns": [
{ "mDataProp": "Analyst", "sTitle": "Analyst", "sClass": "center" },
{ "mDataProp": "Supervisor", "sTitle": "Supervisor", "sClass": "center" },
{ "mDataProp": "Workgroup", "sTitle": "Workgroup", "sClass": "center" },
{ "mDataProp": "CompletedReviews", "sTitle": "Completed Reviews", "sClass": "center" },
{ "mDataProp": "ReviewsToBeCompleted", "sTitle": "Reviews To Be Completed", "sClass": "center" },
{ "mDataProp": "AverageForThePeriod", "sTitle": "Average for the Period", "sClass": "center" },
{ "mDataProp": "AssignmentSet", "sTitle": "Assigned Quizes", "sClass": "center" },
{ "mDataProp": "ScorecardLink", "sTitle": "ScorecardLink", "sClass": "center" }
]
} );
} ); [/code]
This discussion has been closed.
Replies
I'm not sure why it would work in chrome but not IE or FF. I am also not sure why when I try to explicitly define the file path the page fails to load.
I have struggled with this all night - I have now revert to use table tools version 2.0 which can be downloaded from here: https://github.com/DataTables/TableTools/tags
Make sure you change the "sSwfPath": to
/media/swf/copy_cvs_xls_pdf.swf"
The important bit here is that on this version, the middle part of the file was called cvs as opposed to later files showing csv!!!
Dont know why it would work in IE and not firefox, but at least with version2, it works in both
Hope this helps
I was using TableTools 2.0.3 and decided to update the plugin into 2.1.1.
Now, CSV and Copy export work only on Chrome. It doesn't work on Firefox (12 & 13), nor on IE 8.
All was fine with TableTools 2.0.3
I use the plugin with Datatables 1.9.1 and JQuery 1.7.2
I checked the sSwfPath, and it's ok.
Here is the code i'm using:
[code]
$('#mytable').dataTable({
"sDom": '<"dataTables_header"<"dataTables_topinfo"i><"dataTables_toppaginate"p>lfT>rt<"dataTables_footer"<"dataTables_bottompaginate"p><"dataTables_bottominfo"i>>',
"bRetrieve": true,
"oLanguage": {
"sLengthMenu": "Show _MENU_ Results",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ results",
"sInfoEmpty": "No Results",
"sInfoFiltered": "(filtered from _MAX_ total results)",
"oPaginate" :{"sNext" :"", "sPrevious" : ""}
},
"oTableTools": {
"sSwfPath": "../web/applet/copy_csv_xls.swf",
"sRowSelect": "none",
"sSelectedClass": "DTTT_selected",
"fnPreRowSelect": null,
"fnRowSelected": null,
"fnRowDeselected": null,
"aButtons": [ "copy",
{"sExtends": "csv","sFileName": "mydata.csv","bFooter": false},
{"sExtends": "print","sInfo": "Print viewPlease use your browser's print function to "+"print this table. Press ESC (Escape) key to go back."}
]
}
});
}
[/code]
Thanks a lot for your help, i go crazy .. :/
When i modify the HTML code with Firebug and move the element outside of the one, all works fine again on Firefox.
exemple:
(original code, doesn't work):
[code]
CSV
[/code]
(modified code, works !!! ):
[code]
CSV
[/code]
All is ok now on all browsers. Hope this will help:)
Mark
https://github.com/DataTables/TableTools/blob/52d8188f89e84292da0f656e3928ccc6efcf235b/media/js/ZeroClipboard.js
And replaced as per Andreivassaliev comments, and yes, it works fine in Firefox 13, IE9 and latest Chrome release - have not tested in Safari.
Thanks for this
I had the 2.0.3 package saved on my own computer (it was my last recent version of TableTools). But, I don't know if there's an archive section on the website, sorry :s
I may email the corresponding file to you if needed ;)
Unfortunately some of my changes in TableTools 2.1.0 caused compatibility issues with Firefox and IE - specifically, to try and make life easier, I had the Flash element inside the BUTTON tag - but Firefox and IE will not allow Flash to pick up the mouse down / up events (although they do oddly allow mouse in / out) - hence the trouble.
The fix has been committed for this and I'll be packaging up the latest TableTools for release soon. Until then, you can get the latest version with the required fix from the downloads page or Github.
Please accept my apologies for the inconvenience.
Allan
Thank you :)
You don't have to apologize, you make a very good work and we'll never thank you enough for this ;)