Setting up a working export in JSFiddle

Setting up a working export in JSFiddle

jhfrenchjhfrench Posts: 15Questions: 0Answers: 0
edited April 2013 in TableTools
I'm having a very difficult time getting export to CSV/Excel/PDF working in JSFiddle. Please see http://jsfiddle.net/jhfrench/6b74w/64/

When I look at the JavaScript console for http://fiddle.jshell.net/jhfrench/6b74w/64/show/light/ I see [quote]GET http://fiddle.jshell.net/jhfrench/6b74w/64/show/light/media/swf/copy_csv_xls_pdf.swf 404 (NOT FOUND) ZeroClipboard.js:52[/quote]
This error surprises me because I thought I set the path to the SWF file with this code:
[code]
...
"oTableTools": {
"sSwfPath": "http://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
}
...[/code]

How can I get this JSFiddle to demonstrate the export features?

Replies

  • jhfrenchjhfrench Posts: 15Questions: 0Answers: 0
    I think I figured it out. The problem seems to be with TableTools's support of jQuery "compound" selectors. My original selector ($('#browser_data, #task_list')) results in the default (and unavailable) SWF path getting applied to both enhanced tables.

    When I change the selector to $('#task_list') it works.

    See working JSFiddle at http://jsfiddle.net/jhfrench/6b74w/68/. Note that second table is no longer enhanced with DataTable plugin (I'd have to call the plugin on that table with a second call).
  • jhfrenchjhfrench Posts: 15Questions: 0Answers: 0
    Of course, if you want to call DataTables on multiple tables, with TableTools enabled, you can use this syntax:
    [code]
    $('#task_list, #browser_data').each( function() {
    $(this).dataTable({ ...your options here etc...});
    });
    [/code]

    See http://jsfiddle.net/jhfrench/6b74w/80/
  • jhfrenchjhfrench Posts: 15Questions: 0Answers: 0
    For cross-referencing, I contributed similar posts to StackOverflow.com at http://stackoverflow.com/q/16308638/1430996
  • sandippsandipp Posts: 1Questions: 0Answers: 0
    Great broo your code saved and made my day !!!! thanks a ton
This discussion has been closed.