Javascript exceptions with new TableTools

Javascript exceptions with new TableTools

krojewkrojew Posts: 30Questions: 0Answers: 0
edited January 2011 in TableTools
Hi,
I've upgraded to TableTools 2 and I noticed a strange problem. Every time TT loads it thows a javascript exception for every button: Unable to load SWF file - please check the SWF path. The buttons work as expected, so is this exception really needed? It's thrown by ZeroClipboard.js:

[code]
this.loadingTimer = setTimeout( function () {
throw( 'Unable to load SWF file - please check the SWF path' );
}, 10000 )
[/code]

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,469 Site admin
    Can you post a link to your page please? That timer is in there to try and catch by far the most common issue that was experienced with the original TableTools - the SWF file not being loaded.

    Thanks,
    Allan
  • krojewkrojew Posts: 30Questions: 0Answers: 0
    Sorry, I cannot post the page right now. I will post a link as soon as possible.
    In my opinion that exception is unnecessary in current form. Rationale: when the SWF path is invalid, the developer/user will notice it - the buttons will now work. The exception is just redundant is this case. In case of some error (like in my example) or timeout, the exception will be thrown, but the buttons will work anyway, so the exception is unnecessary. In either case this exception doesn't do anything good, it's just a redundant form of saying that something has possibly gone wrong (or not).
    If the developer for some reason cannot see that swf did not load and the exception is needed, I think there should be an option to turn it off.
  • bobwood75bobwood75 Posts: 2Questions: 0Answers: 0
    Allan,

    First, thank you very much for a wonderful plug-in. It is ridiculously flexible, feature filled and reliable. I also appreciate this very well maintained site for all my questions and concerns!

    On to my question... I think I might be experiencing a similar issue with TT 2.0 as krojew. My table works great for the first 10 seconds or so (all buttons, sorting, filtering, paging) using the following config:

    [code]
    $("#tblDetail").dataTable({
    "bJQueryUI": true,
    "oTableTools":
    {
    "sSwfPath": "DataTables/swf/copy_cvs_xls.swf",
    "aButtons":
    [
    "copy",
    "print",
    "xls"
    ]
    },
    "sDom": '<"H"Tlfr>t<"F"ip>'
    });

    [/code]

    I had a little bit of trouble getting the swf to load properly at first but I resolved that by pulling the entire zipped file structure into my project (brute force but it worked). I'm using IE7 and the exception I receive is "exception thrown and not caught". Unfortunately mine is an intranet site but I did fine an example of possibly the same problem on one of your example pages:

    http://datatables.net/extras/tabletools/

    For me, the exception occurs (in both cases) after about 10-15 seconds. But from what I can tell the exception doesn't negatively affect the table functionality at all...

    Any help would be much appreciated. Thanks!
  • allanallan Posts: 63,489Questions: 1Answers: 10,469 Site admin
    I'm wondering if I should just remove that... It seems to be creating just as many issues as it was put in to try and solve! Unfortunately I don't have access to a machine with IE7 on it at the moment, but I've just tried IE8 in standards and compatibility modes and it seems to be fine.

    What should happen is that when the SWF is inserted to the document a timer is started - 10 seconds. Within that time the SWF file should tell the document that it has been initialised and it's ready to go. This will cancel the timer. If the timer times out, an exception is thrown.

    So for some reason it's timing out. Perhaps the timer isn't long enough? Could you possibly try that for me - it's in ZeroClipboard.js line 135.

    Thanks,
    Allan
  • bobwood75bobwood75 Posts: 2Questions: 0Answers: 0
    Allan,

    Thanks for the quick response. After some more toil this morning with my machine I did a reboot... would you believe it is no longer an issue for me? I realized I had a pending IE7 patch, 3 VS 2008s, 2 SQL Server Mgmt Studios, 15 IMs, 7 IE7s, 2 excels... and more running.

    I'm guessing for my machine, at that time, 10 seconds was not enough. Unfortunately to your request I am unable to reproduce the error at this time... either in my own code or on your example page I referenced earlier. I suppose that is a good thing.

    Thanks again!
  • allanallan Posts: 63,489Questions: 1Answers: 10,469 Site admin
    Thanks for the information! It sounds like the 10 second limit might just be a bit optimising to load the SWF on a heavily loaded system. I think I'll bump it up a good bit for the next release.

    Regards,
    Allan
This discussion has been closed.