Unable to use TableTools Copy function (Possible bug?)
Unable to use TableTools Copy function (Possible bug?)
newtodatatables
Posts: 31Questions: 0Answers: 0
Hi there, I have successfully got my TableTools working from my previous thread here: http://datatables.net/forums/discussion/5225/tabletools-fails-to-initialize-copy-pdf-xls-functions-not-working Everything is working fine after I made the right reference to the swf file.
However, when I created another table with different table id in another page, the copy function stopped working. Wonder what is wrong?
Script
[code]
oTable = $('#test').dataTable({
"bFilter": false,
"bSort": false,
"bProcessing": true,
"bDestroy" : true,
"bAutoWidth" : false,
"aoColumns" : [
{ sWidth : "28%" },
{ sWidth : "28%" },
{ sWidth : "14%" },
{ sWidth : "15%" },
{ sWidth : "15%" }
],
"oLanguage": {
"sZeroRecords": "No data found!"
},
"sDom": 'TRC<"clear">lrtip',
"oTableTools": {
"sSwfPath": "plugins/dataTables/TableTools/media/swf/copy_cvs_xls_pdf.swf",
"aButtons": [ "copy",
"print",
{
"sExtends": "collection",
"sButtonText": "Export",
"aButtons": [{
"sExtends": "csv",
"sFileName": "Data.csv",
"mColumns": "visible"
},
{
"sExtends": "xls",
"sFileName": "Data.xls",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sFileName": "Data.pdf",
"mColumns": "visible"
} ]
}
]
}
[/code]
HTML
[code]
Col 1
Col 2
<%
List appList = AppManager.getAppList();
Iterator iter = appList.iterator();
while (iter.hasNext()) {
Application app = iter.next();
%>
<%=app.getName()%>
<%=app.getId()%>
<%
}
%>
[/code]
However, when I created another table with different table id in another page, the copy function stopped working. Wonder what is wrong?
Script
[code]
oTable = $('#test').dataTable({
"bFilter": false,
"bSort": false,
"bProcessing": true,
"bDestroy" : true,
"bAutoWidth" : false,
"aoColumns" : [
{ sWidth : "28%" },
{ sWidth : "28%" },
{ sWidth : "14%" },
{ sWidth : "15%" },
{ sWidth : "15%" }
],
"oLanguage": {
"sZeroRecords": "No data found!"
},
"sDom": 'TRC<"clear">lrtip',
"oTableTools": {
"sSwfPath": "plugins/dataTables/TableTools/media/swf/copy_cvs_xls_pdf.swf",
"aButtons": [ "copy",
"print",
{
"sExtends": "collection",
"sButtonText": "Export",
"aButtons": [{
"sExtends": "csv",
"sFileName": "Data.csv",
"mColumns": "visible"
},
{
"sExtends": "xls",
"sFileName": "Data.xls",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sFileName": "Data.pdf",
"mColumns": "visible"
} ]
}
]
}
[/code]
HTML
[code]
Col 1
Col 2
<%
List appList = AppManager.getAppList();
Iterator iter = appList.iterator();
while (iter.hasNext()) {
Application app = iter.next();
%>
<%=app.getName()%>
<%=app.getId()%>
<%
}
%>
[/code]
This discussion has been closed.
Replies
Allan
By the way, all the other buttons, print, pdf, excel etc are all working fine.
Thanks for your help!
Correct - most likely the SWF file hasn't been loaded. Have a look at the page in Chrome and look at the 'console' of the Developer Tools. It will tell you if you get getting any 404 errors.
I've never heard of the copy not working when the Excel and PDF buttons are working though! I thik I would probably need to be able to reproduce that to have any chance of fixing it.
Allan