Pergunta

I'm having a very difficult time getting export to CSV/Excel/PDF working in JSFiddle. Please see my attempted JSFiddle

When I look at the JavaScript console for http://fiddle.jshell.net/jhfrench/6b74w/64/show/light/ I see

GET http://fiddle.jshell.net/jhfrench/6b74w/64/show/light/media/swf/copy_csv_xls_pdf.swf 404 (NOT FOUND) ZeroClipboard.js:52

This error surprises me because I thought I set the path to the SWF file with this code:

...
"oTableTools": {
            "sSwfPath": "http://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
        }
...

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

Foi útil?

Solução

I think I figured it out. The problem seems to be with TableTools's support of jQuery "multiple" selectors. My original selector ($('#browser_data, #task_list')) results in the default (and unavailable) SWF path.

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

See working JSFiddle. Note that the second table is no longer enhanced with DataTable plugin.

Of course, if you want to call DataTables on multiple tables, with TableTools enabled, you can always use this jQuery syntax:

$('#task_list, #browser_data').each( function() {
        $(this).dataTable({ ...your options here etc...});
});

See http://jsfiddle.net/jhfrench/6b74w/308/ for multiple tables enhanced by DataTables/TableTools.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top