Javascript exceptions with new TableTools
Javascript exceptions with new TableTools
krojew
Posts: 30Questions: 0Answers: 0
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]
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]
This discussion has been closed.
Replies
Thanks,
Allan
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.
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!
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
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!
Regards,
Allan