DataTools buttons show but don't work when there are two tables on the page
DataTools buttons show but don't work when there are two tables on the page
RdeBoer
Posts: 10Questions: 0Answers: 0
Hi,
I'm finding that when using DataTools to display the "Copy, CSV, Excel, PDF, Print" buttons, the buttons don't work when there are two sets of them, one for each of the two tables on the page.
The browser console shows errors like this one (one for each button, except Print):
.../media/swf/copy_csv_xls_pdf.sw
Failed to load resource: the server responded with a status of 404 (Not Found)
Indeed the link should be ".../extras/TableTools/media/swf/copy_csv_xls_pdf.swf", which is what DataTables does generate correctly when there's only one table with export buttons.
Any ideas?
Thanks in advance.
RdeBoer
I'm finding that when using DataTools to display the "Copy, CSV, Excel, PDF, Print" buttons, the buttons don't work when there are two sets of them, one for each of the two tables on the page.
The browser console shows errors like this one (one for each button, except Print):
.../media/swf/copy_csv_xls_pdf.sw
Failed to load resource: the server responded with a status of 404 (Not Found)
Indeed the link should be ".../extras/TableTools/media/swf/copy_csv_xls_pdf.swf", which is what DataTables does generate correctly when there's only one table with export buttons.
Any ideas?
Thanks in advance.
RdeBoer
This discussion has been closed.
Replies
Allan
Thanks so much for your prompt reply! You give great support.
My code does use sSwfPath to set the path through the dataTable and it works great when the 'table' selector returns only one table, but not so great when I change to selector to return both tables on the page.
So this works perfectly:
[code]
$(".view-display-id-block_1 table").dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "sites/all/libraries/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
}
});
[/code]
....whereas this does not:
[code]
$("table").dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "sites/all/libraries/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
}
});
[/code]
The buttons appear correctly, but when clicked nothing happens as the underlying URL points to "/media/swf/copy_csv_xls_pdf.swf " as opposed to "sites/all/libraries/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
Thanks for your help!
Rik
Allan