Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81681

TableTools Buttons only work on the first DataTable

$
0
0
http://debug.datatables.net/ahizel

I have a page that initializes two DataTables using this code:

 
$('#FedExSalesOverview').dataTable({
            "sDom": 'T<"clear">lfrtip',
            "oTableTools": {
                "sSwfPath": "../../Content/TableTools-2.0.0/media/swf/copy_cvs_xls_pdf.swf"
            }, 
...
$('#FedExSalesDetails').dataTable({
            "sDom": 'T<"clear">lfrtip',
            "oTableTools": {
                "sSwfPath": "../../Content/TableTools-2.0.0/media/swf/copy_cvs_xls_pdf.swf"
            },
...

Both use supply the same value for the "oTableTools" parameter. The "copy", "csv", "Excel", "PDF" and "Print" buttons work on the first table ('#FedExSalesOverview'). The buttons appear, but don't do anything on the second table ('#FedExSalesDetails'). Both tables have Sort, Search and other features enabled, and those features work on both tables.

There's an error in the JS console : "uncaught exception: Unable to load SWF file - please check the SWF path"

I've tried to Initialize TableTools "globally" and then apply the tools using sDom, but I don't quite understand how this method works - I just read another blog post about this issue (http://datatables.net/forums/discussion/3963/tabletools-on-multiple-tables/p1) When I do this, I get the same result :

$(document).ready(function () {
 TableTools.DEFAULTS.aButtons = ["copy", "csv", "xls", "pdf"];
 TableTools.DEFAULTS.sSwfPath = "../../Content/TableTools-2.0.0/media/swf/copy_cvs_xls_pdf.swf";
        
        $("#tabs").tabs();
        $('#FedExSalesOverview').dataTable({
            "bJQueryUI": true,
            "sDom": '<"H"Tfr>t<"F"ip>',
...
As you can see, I'm using jQuery.tabs() and I have the HTML for the DataTables on separate tabs.

Viewing all articles
Browse latest Browse all 81681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>