DataTables logo DataTables

via Ad Packs
Table tools v2 copy/xls/csv/pdf dont work
  • bocodebocode
    Posts: 9
    Hi I just downloaded the table tools v 2 and followed all the documentation to plug it/customize it on my site. Unfortunately only the print button is working and the other 4 buttons are not working. I looked in firefox error console
    and i see the following error:

    Error: uncaught exception: Unable to load SWF file - please check the SWF path

    and am getting this error as well:

    b is null
    Source File: http://localhost/shlk/js/jquery.dataTables.min.js
    Line: 61

    I looked at the datatables website and buttons there work properly when accessed from my browser (i can save pdf, csv, xls, and copy to clipboard).

    Any ideas?
    Bo
  • Set path to .swf file.

      "oTableTools": {
                "sSwfPath" : "media/swf/copy_cvs_xls.swf"
    }
  • bocodebocode
    Posts: 9
    Hi 4giedrius,

    This is a given, and i did set this path before i started using TT. BTW the problem is coming from tabletools.js file from the zeroclipboard code. I copied ZeroClipboard.swf in all the places i can think of but still it does not seem to work.

    Only print preview is working rest of the buttons dont.

    am lost for any logical explanation :-(
  • allanallan
    Posts: 15,529
    It is as 4giedrius suggests I think :-). You mentioned ZeroClipboard.swf, but the default TableTools 2 files are called copy_cvs_xls.swf and copy_cvs_xls_pdf.swf. What SWF path are you using? Is it relative or absolute?

    Allan
  • bocodebocode
    Posts: 9
    Hi Allan,

    I've set the path of copy_cvs_xls_pdf.swf properly and that does not seem to pose any problem. I'm referring to this piece of code in TableTools.min.js

    <CODE>
    var ZeroClipboard={version:"1.0.4-mod",clients:{},moviePath:"ZeroClipboard.swf",
    </CODE>

    The path i set in my tabletools initialization code is as follows:

    <CODE>
    "oTableTools": {
    "sSwfPath": "/abc/swf/copy_cvs_xls_pdf.swf",
    "aButtons": [ "copy", "csv", "print" ]
    },
    </CODE>

    The path, as you can i see, is absolute and it is reachable.

    Thank you
    Bo
  • allanallan
    Posts: 15,529
    As you can see in this example ( http://datatables.net/release-datatables/extras/TableTools/swf_path.html ) that should be all that is needed. Could you give me a link to the page please, so I can see what might be happening? You can send it to http://datatables.net/contact if you don't want to make it public.

    Allan
  • bocodebocode
    Posts: 9
    Allan,

    Thank you very much for offering to help. The website is on the intranet and is not accessible from outside.

    However, i wanted this to work very badly so i searched for older version of table tools and i got it from this website: http://www6b.wittenberg.edu/lib/include/jquery/dataTables-1.6/extras/TableTools/

    And it is working as expected except that there is no PDF export.

    One thing i fail to understand is why does new TT version refer to ZeroclipBoard.swf when all it needs is either copy_xls_csv.swf (or the pdf version)?

    Regards,
    Bo
  • allanallan
    Posts: 15,529
    The ZeroClipboard.js file does refer to ZeroclipBoard.swf you are right - but that's effectively redundant, as TableTools will always instruct ZeroClipboard to look else where for the SWF.

    PDF export is something that was new in TableTools 2 - so you would need to use that if you want PDF export.

    If you have Chrome around or Safari have a look at the inspector's console, it will tell you if there are any 404 errors. Likewise have a look at your server logs for 404 errors.

    Allan
  • Good evening,

    Firstly, I would like to express my gratitude for such great add-ons.

    Now, I am having very similar issues, and in ways trying to fix this, have found:
    1. the bundle of all extras with DataTables contains obsolete versions (in particular of TableTools)
    2. all paths work fine, all checked with consoles, only I have a feeling there is an issue with the files contained into the 'as3' directory, is that a likelyhood? does this directory, as well as the 'docs' directory have an impact on the functionning of TableTools?

    Many thanks & kind regards to all.
    Nic
  • I have tried everything I could think of... relocated qll files to match the samples, used the same links.. and tried removing all the unnecessary scripts & libraries... Basically Chrome gives me a momentary freeze and crash, and Firefox does not respond at all... (just installed the latest version of Firefox + Flash)

    Any help or advice would be greatly appreciated... I spent my whole evening attempting to figure it out :S

    PS: actually, I am having exactly the problem described in: TableTools: tableTools2 example doesn't work in firefox, but only in IE (forums)
  • gowrigowri
    Posts: 4
    I had the same issue when i fix sSwfPath all works fain
    Thanks Allan

    But I have another issue


    When i am using [b]Table tools[\b] , the bJQueryUI is not working .. the jquery ui theme is not applying to Data tables

    My Table Configuration
    ====================

    [code]
    var oTable = $('#user_table').dataTable( {
    "aoColumns": [
    { "sClass": "number", "bSortable": false },
    { "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false },{ "sClass": "nonedit", "bSortable": false }

    ],
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "../js/DataTables/media/swf/copy_cvs_xls_pdf.swf",
    "aButtons": [
    "copy",
    "csv",
    "xls",
    {
    "sExtends": "pdf",
    "sPdfOrientation": "landscape",
    "sPdfMessage": "Your custom message would go here."
    },
    "print"
    ]
    },
    "bProcessing": true,
    "bServerSide": true,
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",

    "sAjaxSource": 'ajax_userreport_table?custom_field=a:14:{i:0;s:9:"user_name";i:1;s:15:"user_first_name";i:2;s:14:"user_last_name";i:3;s:13:"user_password";i:4;s:10:"user_email";i:5;s:11:"user_gender";i:6;s:10:"user_phone";i:7;s:8:"user_dob";i:8;s:12:"user_address";i:9;s:12:"user_country";i:10;s:10:"user_state";i:11;s:9:"user_city";i:12;s:12:"user_zipcode";i:13;s:13:"user_reg_date";}'

    });

    [\code]
  • allanallan
    Posts: 15,529
    You need to alter your sDom ( http://datatables.net/usage/options#sDom ) from:

    "sDom": 'T<"clear">lfrtip',
    
    to
    "sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
    
    Allan
  • gowrigowri
    Posts: 4
    Thanks you so much Allan you always great .That works i am always your fan
  • Hi bocode,

    We have the same problem as yours! And I contacted Allan for help. The solution is that try to test and upload it on your web-server and it won't work from the file system (i.e. file://) as Allan said that there are some security settings in Flash, and that is why it is not working. Print button is working because it is not part of the Flash at all.

    Btw, Thanks Allan for the help! :)
  • s8472s8472
    Posts: 1
    I had same problem too and I didn't get the 404 error message.
    The problem was that I was hiding my datatable so all offset values were 0. So my all embed width and height were 0.
    I hope it helps
  • I downloaded DataTables-1.8.2

    navigated to DataTables-1.8.2\extras\TableTools
    The Flash Buttons don't work and I have the Latest Version of Flash.

    I click on the buttons and nothing happens.



    Thanks
  • allanallan
    Posts: 15,529
    Is the swf path correct for your installation? Have a look in your server error log for 404 errors.

    Allan
  • I downloaded DataTables-1.8.2

    navigated to DataTables-1.8.2\extras\TableTools
    The Flash Buttons don't work and I have the Latest Version of Flash.

    I clicked on the buttons and nothing happens.

    I tried this in Firefox and IE.
  • I added

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


    It Still doesn't work.

    It works fine here http://datatables.net/extras/tabletools/
  • allanallan
    Posts: 15,529
    You don't want to pull the SWF (or indeed any other file) off the datatables.net site, since it is not a CDN, and Flash has some XSS protection. You want to put in your own server's address.

    Allan
  • Allan

    I changed the path to see if it would work like it does on your site. I cannot get this work and all the code is the same.
  • allanallan
    Posts: 15,529
    Can you give us the link please?

    Allan
  • Allan

    I downloaded DataTables-1.8.2 from your Website. Extracted the zip file to my Local C Drive

    Navigated to C:\DataTables-1.8.2\extras\TableTools2

    Click on index.html and tried to click on Copy, CSV, Exce, and PDF nothing happens. When I click on The Print button highlights and It comes up in print preview.
  • same problem here
  • allanallan
    Posts: 15,529
    It won't work from a local drive, unless you have a security exception set up for Flash. This is a Flash security setting, and there is no way for me to get around it I'm afraid. You can change the security settings here: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html .

    A better solution is just to dump the files onto a web-server.

    Allan
  • I copied the SWF files to my local server and it works now....
    Thank you for the Explanation.
  • Firstly to Allan and all the other who work on this fantastic stuff - thanks a million, amazing stuff, love it !

    I had same issue - with flash buttons not working.

    I had no 404, and if I used the path directly in the browser I got the flash swf fine.

    so I was very ????

    But as per @s8472 (I think) my problem was not about paths, nor about IIS / asp.net routing failing to serve the request properly (as I had issues with before on another system), but it was simply that I had hidden the buttons with css (and had some Jquery to show them when user wanted to export...)

    I had following css

    .DTTT_container {
        display: none;
    }  
    

    Which was problem. Removing this and everything is hunkey dorey ! :)

    Thanks all.
  • Sorry, so what is the fix for this issue? I have the same problem where the swf buttons show, but clicking on them makes them all vanish accept for the Print button, which pops up preview mode. I want to have the users have the cvs option.

    The code so far:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    
    <style type="text/css" title="currentStyle">
            @import "/media/css/demo_page.css";
            @import "/media/css/demo_table.css";
            @import "/css/jquery-ui/css/redmond/jquery-ui-1.8.4.custom.css";
            @import "/TableTools/media/css/TableTools.css";
    
            a { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: #483D8B; text-decoration: none }
            a:hover { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: #A52A2A; background-color: #FAEBD7}
            h1 { font-family: Arial, Verdana, sans-serif; font-size: 32px; color: #A52A2A }
            h2 { font-family: Arial, Verdana, sans-serif; font-size: 24px; color: #A52A2A }
    </style>
    <script type="text/javascript" src="/media/js/jquery.js"></script>
    <script type="text/javascript" src="/media/js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="/FixedHeader/media/js/FixedHeader.js"></script>
    <script type="text/javascript" src="/TableTools/media/js/TableTools.min.js"></script>
    <title>PERC Entity Location Report</title>
    <script type='text/javascript'>
    
     $(document).ready(function() {
    
                    var oTable = $('#percloc3').dataTable({
                            "sDom": 'T<"clear">lfrtip',
                            "oTableTools": {
                                    "sSwfPath": "/TableTools/media/swf/copy_cvs_xls_pdf.swf",
                            }
                    });
                    new FixedHeader( oTable );
            });
    
    </script>
    </head>
    This displays the buttons, but if you move the mouse over them they vanish, leaving just the Print option.  If I add an aButton for just xls, then no buttons appears.
    
  • Please note that the swf is located on our apache2 server in a subdirectory of htdocs called TableTools, so I think that satisifies the comment above to not run it local.
  • Another note is that if I go and pull up /TableTools/index.html with its example, it works. Other than using sSwfPath and new FixedHeader ( oTable ), I think my stuff is the same now (switched to try TableTools.js just like the index.html that comes with TableTools.
  • i on the other hand have a slightly different problem. Everytime the table loaded with data i got the following error:
    Microsoft JScript runtime error: Object required

    and the code stopped at the function below:

    function __flash__addCallback(instance, name) {
    instance[name] = function () {
    return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
    }
    }

    Can some expert help?

    Edit: Everything worked fine when the table load the fist time but error out everytime after the first time.

    @dshapiro:
    1. Maybe your sSwfPath is wrong and it should be "TableTools/media/swf/copy_cvs_xls_pdf.swf",
    did you try this:
    var oTable = $('#percloc3').dataTable({ "sDom": 'T<"clear">lfrtip', "oTableTools": { "sSwfPath": "TableTools/media/swf/copy_cvs_xls_pdf.swf", } });
    2. Are You missing ?
    <script type="text/javascript" src="/TableTools/media/js/ZeroClipboard.js"></script>
  • I downloaded the TableTools version 2.0 and the problem gone away and everything worked.
    You can download version 2.0 here:
    https://github.com/DataTables/TableTools/tags
  • This is the same for us. Print works but nothing else. The thing that is strange is that the Print button is the only one that when you hover over it it actually changes to the colored PNG. The others don't show the hovered image.

    Any other thoughts?

    Thanks,
    Craig
  • I also had the issue of buttons appearing but doing nothing when clicked, and although I'm not sure of the exact reason why it happened, it discovered it was related to hiding the element that contained the table (using display:none).

    I got around the issue by removing the display:none property on the rule, and setting z-index:-1 instead, to hide the element behind others on the page, and then altering this to a higher value (eg z-index:30) when required before making the table container visible.

    Suddenly the buttons are working as expected!
    Hopefully this helps someone else diagnose their issue.
  • I found something relating to this in the docs (imagine that), where a function exists which you can trigger a redraw of the flash buttons, as they can't be drawn properly if the element is initially hidden.
    More about it here under fnResizeRequired:
    http://datatables.net/extras/tabletools/api
  • I too had major problems getting this to work. All of them my own fault.

    1) I hadn't set the path for the swf correctly and sure enough I had 404s showing in firebug (Net).

    2) If your table is hidden in any way use fnResizeButtons as described below. I not only had tabs but also hidden divs:

    http://datatables.net/extras/tabletools/api#fnResizeButtons

    Similar here:

    http://datatables.net/release-datatables/examples/api/tabs_and_scrolling.html

    3) Thanks Luke for suggesting this one, I don't know how much more time I'd have spent looking for it otherwise ...

    I had managed to corrupt the delivery of the swf file. The 404s ceased but my problems still persisted.

    I'd inadvertently used the same character stream type (server side) that I use for delivering text file resources!

    This corrupted the file but it was not apparent from any of the client side flash debugging / logging
    utilities. All I got was something like 'Movie not loaded' when I right clicked the flash buttons!

    Note, when serving the swf, also make sure you set the content type correctly, i.e.

    application/x-shockwave-flash

    If you think you've fixed all other issues, and suspect the serving of the file may be corrupting it,
    consider locating the (original) file locally on the test client machine. You will have to change the
    swf path and flash security settings (see Allan's comment, on this thread, October 2011).

    I hope this helps.
  • And there's more ...

    When we deployed to our test environment we found the file corruption returned. This time, however, the problem was caused by our maven build.

    The symptoms:
    1) The same inactive flash buttons as described above.
    2) The swf file was being served as a file of about 1.8k when it should have been 2.1k.

    The fix:
    Check out the warning at the bottom of the following page:
    http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
  • I have an issue using table tools plugin in my portal application.

    The only button that works is the print. When I right click on the CSV/Excel button is shows two options
    1) Movie not loaded
    2) About Adobe Flash 11.1.102.55

    I have the swf file in the right location and is reachable. I do not see any 404 errors in firebug.

    I set sSwfPath:"copy_cvs_xls_pdf.swf" and the TableTools.min.js and swf files are in the same folder.


    How do I resolve this issue.
  • Hi Allan,

    Firstly I would like to thank for such a great tool.

    I am facing some problem using Table tools. Actually i am implementing to export data through CSV and pdf formate. Its works absoultly fine with local host. whereas once we deployed to development instanst, the flash buttons are not showing as a clickable aswell nothing happening when we click on csv or pdf also we dont find any errors. I am using version:"1.0.4-TableTools2".

    It would be really great & helpfull if you provide a solution...

    thanks,
    jo
  • Hi Allan,

    I'm having problems with csv and pdf. Look, everything works fine if I run the swf_path.html in the default route. But it doesnt works if I move that file to the root (obviously I updated routes too.).

    Flash is running but when the pop up window is open to save the file (pdf, csv or excel) it loses the document type. In other script, it opens the pop up windows to save the file but my browser close it or gets freeze

    I need some help. Thanks
    Sorry for my english I'm still studying :)
  • Hi All, Great script

    Is there a smaller version of jquery.dataTables.js ?

    i use it only to export a table to pdf and 364kb is to big for what i use it for

    cheers!

    Sam
  • giabmfgiabmf
    Posts: 1
    So I've been trying to get this thing working all day and I'm still at square one. I've tried everyone's suggestions, I've even installed three other browsers to see if that is an issue. What's even more surprising is the buttons appear and function fine on my coworkers box and we're using the same code base so what could the issue be? After inspecting the html the classid is loading correctly but the buttons just won't work. After looking at the response codes in fiddler, the path to the swf is getting loaded correctly. I'm using the most recent version of TableTools and the DataTable. Can someone please help?

    Here is my code:

    $(document).ready(function () {

    var dt = $('#LogTable').dataTable({
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "/Scripts/media/swf/copy_csv_xls_pdf.swf"
    },
    "bPaginate": false,
    "bInfo": false,
    "bProcessing": true,
    "bScrollInfinite": true,
    "bScrollCollapse": true,
    "sAjaxSource": "Log/Details",
    "fnServerData": function (url, data, callback) {
    $.ajax({
    "url": url,
    "data": data,
    "success": callback,
    "contentType": "application/x-www-form-urlencoded; charset=utf-8",
    "dataType": "json",
    "type": "POST",
    "cache": false,
    "error": function () {
    alert("DataTables warning: JSON data from server failed to load or be parsed. " +
    "This is most likely to be caused by a JSON formatting error.");
    }
    });
    },
    "bServerSide": true,
    "sScrollY": "600px",
    "bDeferRender": true,
    "aoColumns":
    [
    { "aTargets": [0], "bSearchable": true, "bSortable": true },
    { "aTargets": [1], "bSearchable": true, "bSortable": true },
    { "aTargets": [2], "bSearchable": true, "bSortable": true },
    { "aTargets": [3], "bSearchable": true, "bSortable": true }
    ],
    "sZeroRecords": "Loading data from server...",
    "fnInitComplete": function (oSettings) {
    oSettings.oLanguage.sZeroRecords = "No matching records were found.";
    }

    });

    $("#accordion").accordion({
    collapsible: true
    });

    });
  • kaspaaskaspaas
    Posts: 2
    I also have same problem: I can see all the buttons but only print works. The reference to the swf file are correct are there are no 404 errors and no js errors in the dev tools in Chrome. I've checked the example on the site http://datatables.net/release-datatables/extras/TableTools/pdf_message.html and that works fine in Chrome. It also works fine in IE(9) and Firefox. Any suggestions would be great
  • nawienawie
    Posts: 1
    i alse have the same problem too,and got stuck on it..
    after i saw the directory of swf file and amazed that there are two swf version,
    one from previous version of datatables named "copy_cvs_xls_pdf.swf" and one from new datatables "copy_csv_xls_pdf.swf".

    renamed my swf source to newer and now it works well
  • kishorekishore
    Posts: 1
    Hi Allan,

    I am also a fan of yours and Datatable/Tabletools etc.
    I am able to do export excel/PDF/copy however,
    I need the headers in bold,is it possible and can we format the cell to give some size?

    Regards,
    Kishore
  • AndyDAndyD
    Posts: 1
    I was having similar issues with the buttons not working until I realised that the filename I was looking for was not correct, I was including (copy_cvs_xls_pdf) in my path (as are many of the examples posted above) when in fact the correct filename in my folder was (copy_csv_xls_pdf) - CVS/CSV being the point of difference.

    Hope it helps.
  • IvanwIvanw
    Posts: 7
    I've also had the same problem with getting the csv and pdf buttons to work when declaring them as part of a "collection". When I declare them as standalone buttons as below everything works as it should. Strange.

    "aButtons": [
    "print",
    {
    "sExtends": "pdf",
    "sButtonText": "Print PDF",
    "mColumns": "visible"
    },
    {
    "sExtends": "xls",
    "sButtonText": "Export to Spreadsheet",
    "mColumns": "all"
    }
    ]
  • allanallan
    Posts: 15,529
    I'm afraid that this is a bug in TableTools 2.0.3 :-(. It will work fine in 2.0.2, but I introduced a change which unfortunately broke that in 2.0.3 - I will be looking at correcting that and issue a new release soon.

    Allan
  • mwirthmwirth
    Posts: 1
    Thanks @AndyD!

    I was facing the same issues with non-working buttons. This originated also from the "typo" in the filename within the swf folder "copy_cvs_xls_pdf" and the filename that is given in the example page for TableTools "media/swf/copy_csv_xls_pdf.swf".

    Tiny difference, hard to catch. :)

    I also use this occasion to say a big "Thank you, Allan" for sharing this project!
  • Hey Allen - Thanks! I seem to have gotten the right combination in the meantime...

    Datatables: 1.9.1
    Reverted to TableTools: 2.0.2
    Referencing: copy_cvs_xls_pdf.swf (not copy_csv_xls_pdf.swf)

    Using The following JS (Forgive me, I've forgotten who posted this originally, I found it through these forums)


    $("#report-tabs").tabs( {
    	"show": function(event, ui) {
    		var jqTable = $('table.display', ui.panel);
    		if ( jqTable.length > 0 ) {
    			var oTableTools = TableTools.fnGetInstance( jqTable[0] );
    			if ( oTableTools != null && oTableTools.fnResizeRequired() )
    			{
    				/* A resize of TableTools' buttons and DataTables' columns is only required on the
    					* first visible draw of the table
    					*/
    				jqTable.dataTable().fnAdjustColumnSizing();
    				oTableTools.fnResizeButtons();
    			}
    		}
    	}
    });
    
  • Sid18Sid18
    Posts: 14
    Hi Allan,

    I have Datatables v1.9.1 and TableTools2.1.1. I dont see any buttons but i get this message :
    Warning:TableTools2 requires Datatables1.9.0 or newer
    and then i get the table wihtout any of those buttons

    Pls help

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion