Is there a change to Flash Movie in the nightly build of Table Tools?
Is there a change to Flash Movie in the nightly build of Table Tools?
salman_kagzi
Posts: 12Questions: 0Answers: 0
Hi. I have just updated to Table Tools nightly build 2.0.3.dev Thu 1st Mar 2012, 11:12. After the update I have started getting following JavaScript error which I never got when using the Stable Version.
this.domElement.parentNode is null
https://localhost/saas/res/javascript/ZeroClipboard/ZeroClipboard.js
Line 133
I was wondering if there is any changes to the Flash Movie or ZeroClipboard.js file in the nightly build which is not available for download on that page?
this.domElement.parentNode is null
https://localhost/saas/res/javascript/ZeroClipboard/ZeroClipboard.js
Line 133
I was wondering if there is any changes to the Flash Movie or ZeroClipboard.js file in the nightly build which is not available for download on that page?
This discussion has been closed.
Replies
This error happens when I reload the table HTML (using AJAX) as and when the options (on which the table data depends) change. Thus when the new table is loaded and DataTables (with which TableTools) is initialized.
I think we need here is to Destroy the Older ZeroClipboard instances that were created, i.e. the older buttons.
As it now stands TableTools does not have a destroy method. I can write one though. I have been looking throught he code to find out if the Flash buttons that are creted when the TableTools is initialized are saved some where, but couldnt find it (possibly my poor understand of JavaScript).
Can you let me know how can I get access to these buttons or movie instances created?
Code for Destroy method. (Not something very elegant in JavaScript)
1. Added a new variable to store instances of Flash Movies created for this Table Tools instance
[code]
/**
* To store refrences for Flash buttons created for this TableTools instance.
*
*/
"aoFlashButtons": []
[/code]
2. Updated "_fnFlashConfig" method to push new instances of flash buttons created to this Array
[code]
this.s.aoFlashButtons.push(flash);
[/code]
3. Added a destroy method
[code]
/**
* Destroy ZeroClipboard clients for this TableTools instance
* @method fnDestroy
* @returns void
*/
"fnDestroy": function ()
{
for (var inst = 0, limit = this.s.aoFlashButtons.length; inst < limit; inst++) {
var temp = this.s.aoFlashButtons[inst];
temp.destroy();
}
},
[/code]
Allan. This can definitely be improved I think and would be nice to have a Destroy method for this plugin.
Anyways, this didn't solve the problem though. On continuing the Deep Dive session I finally go to [quote]"_fnFlashGlue"[/quote] function where I think problem could have had been happening.
It seems that even after calling destroy on the buttons that were created, the HTML is still there on the page(I am using Collection here). And when the new buttons get initialized it seems to be picking up old HTML. Now this is there I got lost and couldn't figure out what the problem is.
Workaround that finally got me through was to let go of collection and place the CSV & Excel export buttons and place them next to the Copy button.
I am still curious to know if this is a bug with TableTools or is there something wrong in the way I am using TableTools.