Table tools v2 copy/xls/csv/pdf dont work - Page 3

Table tools v2 copy/xls/csv/pdf dont work

13

Replies

  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    What does the Javascript console say on your browser? Most likely you are getting a script error.
  • Sid18Sid18 Posts: 14Questions: 0Answers: 0
    the java script error says : fn.DataTable is null or not an object.
    i checked the TableTools.min.js and found this line : fn.dataTableExt.fnVersionCheck("2.0.3")

    The version seems to be compatiable with the curent DataTable version, but still i get this warning message and finally might be the reason for not displaying of the buttons?

    Your suggestions are awaited!
  • Sid18Sid18 Posts: 14Questions: 0Answers: 0
    any updates please?
  • Sid18Sid18 Posts: 14Questions: 0Answers: 0
    Actually i see there is a site.css that is also used in the Initialisation code, but that was not provided as a part of the source, and it references the local absolute path as /../media/site.css - do you think this is the one causing this issue? If so, could you pls place the site.css available in the source for us to download and check if the buttons are displayed?
  • 2bb2bb Posts: 5Questions: 0Answers: 0
    edited June 2012
    I have an issue that I have been fighting with off and on for awhile now.

    I am able to get Table Tools working when the .swf is hosted locally, but when hosted on a web server I run into the button not working issue.

    I have verified the path and file names, tried different web servers as a host, tested other flash files on the web servers (without problems), loaded the file directly in a url and can not find any issues.

    I get no 404 errors, and both the js console in Chrome and Fiddler report the file is loaded correctly.

    Here is the Data Table and Table Tools code snippets:

    [code]
    //DataTable
    $('#example').dataTable({

    "aoColumns": [
    null,
    null,
    null,
    null,
    null,
    null,
    { "bVisible": false },
    { "bVisible": false },
    { "bVisible": false },
    { "bVisible": false },
    { "bVisible": false },
    { "bVisible": false },
    { "bVisible": false }
    ],
    "bPaginate": false,
    "bLengthChange": false,
    "bFilter": false,
    "bSort": false,
    "bInfo": false,
    "bAutoWidth": false,
    "bJQueryUI": true,
    "sDom": '<"top"i>rt<"bottom"flp>T<"clear">',




    "oTableTools": {

    "aButtons": [ "copy", "csv", "xls"],
    "sSwfPath": "http://xxxx/copy_csv_xls.swf"
    //"sSwfPath": "C:/swf/copy_csv_xls.swf" -->This works when swapping the two lines

    }
    [/code]

    Not sure what I am missing....anyone have any thoughts?
  • 2bb2bb Posts: 5Questions: 0Answers: 0
    edited June 2012
    @sid18 - You are missing a reference to ZeroClipboard.

    Find the file named "ZeroClipboard.js" and add the path to your header.
  • Sid18Sid18 Posts: 14Questions: 0Answers: 0
    Thank you for looking into my issue @2bb, However i tried to include the reference to ZeroClipBoard.js and i still get the Warning message and the buttons still dont get displayed :(

    its been 2 days since working on this and still no clue !
  • Sid18Sid18 Posts: 14Questions: 0Answers: 0
    can you pls check if my code that i pasted works in any of your browser? and see if the buttons are displayed - this way i wanted to be sure my code is good
  • 2bb2bb Posts: 5Questions: 0Answers: 0
    I added the reference to ZeroClipboard.js and everything worked fine in Chrome.

    Do you see any javascript errors when using a javascript console (Chrome and Firefox bot have this utility)?
  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    You are running into a security restriction in Flash. In order to prevent dodgy code running locally, you need to explicitly tell it to allow access if you are using file:/// - http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

    Allan
  • 2bb2bb Posts: 5Questions: 0Answers: 0
    Allan - not sure who you were referring to in the above post, but if it was me - the weird thing is I updated Flash security settings and it works locally, but NOT from web servers.
  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    Sorry yes, that was for yourself. Also it would be work making sure you are using the very latest version of TableTools 2.1.2. 2.1.[01] had an issue with non-Webkit browsers...
  • 2bb2bb Posts: 5Questions: 0Answers: 0
    Allan - Thanks for responding...

    I did find I was on an older version of TableTools (thought I had verified, but clearly had not). Loaded the newest version, and still having the same issues.

    Added the server location to the "always trust" list in Adobe Security Settings, just to reduce a variable.

    As I mentioned, both the js console and fiddler show the file successfully loading.

    Thought it may be the flash file being corrupted when served, but other flash files from the same location work just fine.

    What else could I be missing?
  • Sid18Sid18 Posts: 14Questions: 0Answers: 0
    Well , i added the flash security settings to allow this SWF file from my local system.
    However i still get the Warning and the Javascript error shows :the fn.DataTable is null.

    I get the warning as TableTools2 works with Datatables 1.9.0 or newer --Am using DataTables version of 1.9.1
    I have even added the reference to the ZeroClipboard.js , but still doesnt get the Buttons displayed on my local machine.

    Am i missing anything to check?
  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    @Sid18 - can you give us a link please

    @2dd - I'm afraid I don't know. I highly doubt the Flash file will be corrupted from the server. If you have a link, perhaps we might be able to see something.

    Allan
  • nbross2215nbross2215 Posts: 4Questions: 0Answers: 0
    I have been lurking in this thread for a bit - and am running into some similar issues.

    Debug Code - abijez

    Issue: Table looks great with datatables, added tableTools so I can export as excel or pdf. Print takes me to print view just fine, however i just get text of buttons rammed together - no flash or buttons at all. Flash is installed on my pc - swf is on server itself and no console errors in chrome or IE (my own web box).

    Any ideas?
  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    Can you link us to the page please? My guess is that you might be initialising the table in a hidden element.

    Allan
  • nbross2215nbross2215 Posts: 4Questions: 0Answers: 0
    Unfortunately - the data is actually sensitive and on an internal only box - however - code for entire page is here (edited credentials of course)

    [code]

    <?php

    $site = $_GET['site'];
    if(!$site){exit;}

    getcountsbyap($site);

    $testq = pg_query("SELECT equipment.description FROM equipment LEFT JOIN basestation ON equipment.equipid=basestation.equipid WHERE basestation.siteid=$site");

    function getcountsbyap($site){
    $query = pg_query("SELECT name,address[1] as street FROM customers LEFT JOIN customer_custom_fields ON
    customers.customerid = customer_custom_fields.customerid WHERE field_id=13 AND
    substring(value from 1 for 4) = '$site' AND customerstatus[1]='current'")or die(pg_last_error());
    echo pg_num_rows($query);

    echo "Customer NameAddressSite";
    while($row=pg_fetch_array($query)){
    echo "".$row['name'].''.$row['street']."".$site."";
    }
    }
    echo "";
    killconnect($conn);
    ?>

    @import "../datatables/media/css/demo_page.css";
    @import "../datatables/media/css/demo_table.css";







    $(document).ready( function () {
    $('#res1').dataTable( {
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "../datatables/extras/TableTools/media/swf/new.swf"
    }
    } );
    } );



    [/code]
  • nbross2215nbross2215 Posts: 4Questions: 0Answers: 0
    Update - Found out the buttons are on the screen but are empty and on the far left of the page. Text is centered and rammed together "CopyCSVExcelPDFPrint" but in empty space to far left buttons are there (invisible it seems as images are not loaded)
  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    Looks like you need to include the TableTools CSS as well.

    Allan
  • nbross2215nbross2215 Posts: 4Questions: 0Answers: 0
    Aha! You are the man. :) Thank you my good sir ( assuming you are a sir) . :) I will keep you updated on any future fun.
  • allanallan Posts: 61,431Questions: 1Answers: 10,048 Site admin
    > assuming you are a sir

    Heh - last time I checked, yes :-)

    Good to hear that did the business for you.

    Allan
  • MrMarkMrMark Posts: 3Questions: 0Answers: 0
    Is anyone else still seeing IE crash when a user tries to Save as CSV or PDF even AFTER moving the code to a server? I understand that if I make it a 'Trusted Site' in IE settings, it works fine, but I cannot instruct every single user to trust my site. If anyone has seen a solution, please send it my way.
  • platetoneplatetone Posts: 3Questions: 0Answers: 0
    This might help others. I see this exact same thing in Firefox only when I go to http://localhost:8080 trying to run my app with TableTools. If I go to my local IP address instead it works fine, e.g.: http://192.168.1.1:8080.

    There obviously something wrong with Flash player and Firefox when going to localhost (I've seen other stuff on the Internet about this in different situations than Datatables). Pretty damned annoying. I'll try some of the examples above about tweaking security settings.
  • ntyagintyagi Posts: 2Questions: 0Answers: 0
    Hi,
    I have issue where i don't see the buttons(export,pdf,print ..) for table with large number of columns. I am using "sScrollX": "100%",
    "sScrollXInner": "270%",
    "bScrollCollapse": true,

    and also in css
    #dataTable {
    width: 100% !Important;
    }

    With this the table shows with horizontal scroll bar, but the button does not appear any more.
    What can i do to make the button appear just fine, no matter what the width of the table is?
    Kindly Help.
    Thank You.
    Nitish
  • ntyagintyagi Posts: 2Questions: 0Answers: 0
    I should also mention that even the searchbox does not show up, so i am guessing its a jquery error.
    I see following message in the console:
    1. TypeError: oTable.fnSettings() is null
    [Break On This Error]

    var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
    2.TypeError: a.aoColumns[c] is undefined

    Thank You.
    Nitish
  • shammipatneshammipatne Posts: 1Questions: 0Answers: 0
    Is there any way to display only export icon in place of Text on export buttons.
  • yevheniycyevheniyc Posts: 1Questions: 0Answers: 0
    Hi Everyone!!

    Here is what "FINALLY" worked for me:

    TableTools.js - version 2.1.3
    jquery.dataTables.js - version 1.9.4
    Local Server - I used IIS7 [ turned off static and dynamic compression ]
    Modify Flash permissions to "Always Allow" [as Allan recommended] at:
    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
    - also remember to restart your browser [ even erase cache if possible ]

    With Simple initiation:
    $(document).ready( function () {
    $('#example').dataTable( {
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "http://localhost/copy_csv_xls_pdf.swf"
    }
    } );
    } );

    Hope it helps.
    Cheers,

    yev

    P.S. Thank you, Allan - awesome work!!
  • davidliang2008davidliang2008 Posts: 2Questions: 0Answers: 0
    edited February 2013
    Mine was not working too even I included the correct swf path. Double check if you have included the TableTools css. Mine works after I add that one in.
  • bgbbmmbgbbmm Posts: 1Questions: 0Answers: 0
    I created an account JUST to post on here. I upgraded datatables and tabletools, and I did not copy out these new .swf files, nor did I realize that the named had changed. It took a lot of time and digging to finally realize what the problem was. It took me stumbling across someone else's post here about the names being different to finally resolve the problem. Make sure the sSwfPath is definitely being set to the correct version which is included in the TableTools download. The name may have changed from a previous version you were using. Check character by character. The new name is "copy_csv_xls_pdf.swf". Update your script to set it correctly!
This discussion has been closed.