TableTools fails to initialize (copy, pdf, xls functions not working)

TableTools fails to initialize (copy, pdf, xls functions not working)

newtodatatablesnewtodatatables Posts: 31Questions: 0Answers: 0
edited June 2011 in TableTools
I believe this is a repeated problem many have faced but cant get the solution. I have downloaded the full TableTools at http://datatables.net/extras/ and seen the example. I am using IE 8 and the online example works great but not the local version. However, after the download and the adding of the necessary files such as the jquery.js and datatables.js, the copy, pdf, xls functions do not work. The page loads fine with the proper icons but nothing appears when i click on them. I have tried opening the file directing (file:// in IE) and have also tried deploying on a local host using Apache tomcat, and it failed too.

I have also viewed this thread for help http://datatables.net/forums/comments.php?DiscussionID=3871&page=1#Item_0

Import functions and init script in index.html
[code]

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







$(document).ready( function () {
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip',
"sSwfPath": "TableTools/media/swf/copy_cvs_xls_pdf.swf"
} );
} );


[/code]

TableTools is my main folder. My datatables.js and jquery.js are in another folder and the proper import has been made. One weird thing is "right clicking" on the icon shows that Adobe flash is not loaded. Could this be the problem? I am using Flash player 10,1,53,64 as shown in http://www.adobe.com/software/flash/about/

Hopefully someone can guide me on this. Thank you.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Yup - Flash it the problem - as noted in the thread you linked to and the other threads in the forum with a similar problem. Have a look in your server log and likely you've have a 404 error. You need to set the sSwfPath parameter to pick up the SWF file correctly - i.e. where ever you put it on your server.

    Allan
  • newtodatatablesnewtodatatables Posts: 31Questions: 0Answers: 0
    edited June 2011
    Thanks for your reply. Unfortunately I still cannot get it working. There is nothing in my server log. The button is clickable though. I have even tried putting copy_cvs_xls_pdf.swf into the same folder as my index.html and it still does not work.

    Allan, have you tried this on a local server? Is it supposed to work in the local server? Or must I actually launch it on an actual server? And regarding the path, it should be using relative path as what I did right?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    It will work on a local web-server - but not (by default) from the local file system (i.e. file:// in your browser). This is a security mechanism that is in Flash. That can be controlled here: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html . If you are are using a web-server then open 'Inspector' in Chrome it will tell you about any 404 errors.

    Allan
  • newtodatatablesnewtodatatables Posts: 31Questions: 0Answers: 0
    Thank you very much. It was indeed the reference path for the swf file. I found out there was another error on my part. The tabletools.js was not imported correctly.
  • newtodatatablesnewtodatatables Posts: 31Questions: 0Answers: 0
    edited June 2011
    just one last qs, I understand that if a column is initially set to bVisible: false, it will not be exported as csv, pdf or xls. However, I have a "show/hide" column toggle without bVisible:True during initialization. ( http://datatables.net/release-datatables/extras/ColVis/exclude_columns.html ) but when the user deselects a column, the full table still get exported. Is there any way to resolve this?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    All columns are exported by default. You can change that using this parameter: http://datatables.net/extras/tabletools/button_options#mColumns

    Allan
  • d34ld34l Posts: 2Questions: 0Answers: 0
    Hi everyone

    I have a question. Locally (file:///) the export does not work (nothing happens). But when the module is hosted everything works. As you say it's a safety issue.

    By this fact, the module works fine on PHP (Apache2). But in asp.net (IIS) that does not work either, such a local file (file:///) nothing happens.

    How the export works? is there an issue?

    Thank you very much in advance.

    Deal.
  • d34ld34l Posts: 2Questions: 0Answers: 0
    I'm sorry

    The export on asp.net(IIS) works fine!

    I forgot to set the swf file correctly : copy/paste :(

    Thank you
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    See this post for why when using file:// - http://datatables.net/forums/comments.php?DiscussionID=4759 . It's a security feature of Flash.

    Allan
  • SanjivaniSanjivani Posts: 1Questions: 0Answers: 0
    Export works on IE but not on Chrome. Any solution?
  • newtodatatablesnewtodatatables Posts: 31Questions: 0Answers: 0
    Tested working on latest version of chrome
  • newtodatatablesnewtodatatables Posts: 31Questions: 0Answers: 0
    Unfortunately for me, "copy" function still not working on my second datatable.
  • DhurgaDhurga Posts: 10Questions: 0Answers: 0
    when saving in excel files it is saved.But after saving alignment is not proper, For example if we have
    two headings such as employee and status, bot are displaying in same column in excel.Everything get collasped.Suggest about this....

    Thank You
  • kaspaaskaspaas Posts: 2Questions: 0Answers: 0
    edited May 2012
    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.

    Update:
    Just for interest sake I found the problem - I included the external plugin jquery.ui.touch-punch.min.js for making jquery draggable work on the ipad. This was for some reason causing problems in Chrome on the mentioned page. When removed all the exports work again.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Please link us to a test page showing the problem.

    Allan
  • sugamkalps2007sugamkalps2007 Posts: 4Questions: 0Answers: 0
    PDF Export works in Development and QA but not in live. Any suggestions please?
This discussion has been closed.