[solved] tabletools: clipboard ok but not export (csv or xls)

[solved] tabletools: clipboard ok but not export (csv or xls)

xavierxavier Posts: 10Questions: 0Answers: 0
edited September 2009 in General
Hi,

I moved the tabletools under a different folder than usual, then added a

[code]TableToolsInit.sSwfPath="/themes/meps/tabletools/swf/ZeroClipboard.swf";[/code]

I got the little icons, it copies properly into the clipboard, however, nothing happen on the csv or xls. No msg, no error message on firebug.


Is there an extra plugin that should be loaded to make it work ? Otherwise, is it possible to run in debug mode the swf to get more information ?

Any suggestion more than welcome...

X+

Replies

  • allanallan Posts: 63,192Questions: 1Answers: 10,412 Site admin
    HI xavier,

    Interestingly it sounds like you might be running into a similar problem as Lili: http://datatables.net/forums/comments.php?DiscussionID=659 .

    If the clipboard works, then the save to file really should as well. I assume you have Flash 10 plug-in installed? You might be able to put the Flash player into debug (right-click and enable debug I think), but I'm not entirely sure. This isn't something that I've seen myself.

    It's possible that the data is doing something funny along the way - can you provide a sample link?

    Regards,
    Allan
  • xavierxavier Posts: 10Questions: 0Answers: 0
    Yeap, Flash 10 (on linux).

    On a related ? note, it crashes chromium.

    Not too keen on the idea of putting it live, and I don't have any public dev space. Let me try finding a solution...
    X+
  • johnchristosjohnchristos Posts: 2Questions: 0Answers: 0
    I downloaded DataTables & Tabletools this morning and ran into the same problem, man. Copy to clipboard worked great but save to xls/csv did not work in my webpage. No errors were logged in firebug as well.

    Well, after inspecting "TableTools.js", I found the cause of the error. - illegal characters in the title of the page.

    For some reason, the swf does not show the "save as" dialog if there are illegal-for-windows characters in the title tag. (tabletools.js uses the title tag as the default filename).

    I got it to work after modifying the function fnGetTitle( ) in TableTools.js. This is my mod:

    [code]
    /*
    * Function: fnGetTitle (Mod: Fix for illegal chars in title tag
    * Purpose: Get the title of the page (from DOM or user set) for file saving
    * Returns:
    * Inputs:
    */
    function fnGetTitle( )
    {
    if ( _oSettings.sTitle != "" )
    return _oSettings.sTitle;
    else

    var $page_title = document.getElementsByTagName('title')[0].innerHTML;
    var $clean_page_title = $page_title.replace(/<|>|:|"|\/|\\|\||\?|\*|\.\./ig, "");

    // Limit Length to be safe .. :)
    if( $clean_page_title.length >= 100)
    {
    $clean_page_title = $clean_page_title.substr(0, 100);
    }

    return $clean_page_title;
    }

    [/code]

    I hope this helps and do let me know if you found another fix.

    Cheers!

    John C
  • xavierxavier Posts: 10Questions: 0Answers: 0
    I'll test later today.

    X+
  • allanallan Posts: 63,192Questions: 1Answers: 10,412 Site admin
    Hi John - Nice one thanks for your fix. A similar fix will be in the next release of TableTools. There is also an issue with server-side processing / Ajax data which has numbers in it (i.e. not a string) - which I've also got a fix for, but I'm holding off on the release because it appears that there is a problem with UTF8 characters. Unfortunately I've not been able to reproduce that and those which have experienced it haven't got back to me with an example - so the release might come fairly soon...

    Regards,
    Allan
  • xavierxavier Posts: 10Questions: 0Answers: 0
    Hi,

    John C patch worked for me too.

    Thanks !

    X+
  • RRStoyanovRRStoyanov Posts: 12Questions: 0Answers: 0
    Looking forward for this update, too ;)
  • johnchristosjohnchristos Posts: 2Questions: 0Answers: 0
    Awesome.. :)
  • jonasjonas Posts: 11Questions: 0Answers: 0
    Quick question to Allan. Has this fix been included in the latest version of TableTools ?

    The source file of the latest package says " * Created: Wed 1 Apr 2009 08:41:58 BST".

    Cheers
  • allanallan Posts: 63,192Questions: 1Answers: 10,412 Site admin
    Yes I believed this to be fixed in the current release of TableTools. The comment you've noted is the created date, not the last modified (which I don't have in the file).

    Allan
This discussion has been closed.