TableTools IE7 ajax reload issue
TableTools IE7 ajax reload issue
froind
Posts: 2Questions: 0Answers: 0
First of all, DataTables and DataTools are great!
Now, to my issue in IE7: after repopulating the page with the results from a second ajax call and rebuilding the DataTable, the browser starts trowing errors in an infinite loop. I have tracked the issue to the swf file. The error output is as follows.
The thing is that after the first ajax call everything works fine. The error occurs only after the second call.
[quote]
SCRIPT5007: Unable to set value of the property 'setHandCursor': object is null or undefined
SCRIPT5007: Unable to set value of the property 'clearText': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setText': object is null or undefined
SCRIPT5007: Unable to set value of the property 'appendText': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setFileName': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setAction': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setCharSet': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setBomInc': object is null or undefined
EDIT: Other browsers would throw an error for the ZeroClipboard.js file. Tracking the error down got me to the DTTT_collection div.
[/quote]
Here is my DataTables initialisation code. I call this code after the ajax request has completed successfully:
[code]
$("#dataTable").dataTable({
"bJQueryUI": false,
"bAutoWidth": false,
"bDeferRender": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"bStateSave": false,
"sDom": 'RlfCT<"clear">W<"clear">r<"tablediv"t>ip<"clear">',
"oColVis": {
"buttonText": " Show / hide columns"
},
"oColumnFilterWidgets": {
"aiExclude": [0]
},
"bProcessing": true,
"oTableTools": {
"aButtons": [
{
"sExtends": "collection",
"sButtonText": "Tools",
"aButtons": [ "csv", "xls", "pdf" ]
}
],
"sSwfPath": "resources/swf/copy_cvs_xls_pdf.swf"
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
];
});
[/code]
EDIT:
!!!!SOLUTION!!!
It seams that the DataTools plugin creates the DTTT_collection div just at the end of the body. If somebody tries to recreate a table from an ajax call by clearing the the original html and calling the DataTable() on the new one, the TableTools plugin tries to recreate the DTT_collection div and the flash object. Trying to recreate the flash object is what triggers the errors. The solution is to remove the DTTT_collection div along with the html table when recreating from ajax.
I hope this helps other people.
Any ideas?
Now, to my issue in IE7: after repopulating the page with the results from a second ajax call and rebuilding the DataTable, the browser starts trowing errors in an infinite loop. I have tracked the issue to the swf file. The error output is as follows.
The thing is that after the first ajax call everything works fine. The error occurs only after the second call.
[quote]
SCRIPT5007: Unable to set value of the property 'setHandCursor': object is null or undefined
SCRIPT5007: Unable to set value of the property 'clearText': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setText': object is null or undefined
SCRIPT5007: Unable to set value of the property 'appendText': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setFileName': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setAction': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setCharSet': object is null or undefined
SCRIPT5007: Unable to set value of the property 'setBomInc': object is null or undefined
EDIT: Other browsers would throw an error for the ZeroClipboard.js file. Tracking the error down got me to the DTTT_collection div.
[/quote]
Here is my DataTables initialisation code. I call this code after the ajax request has completed successfully:
[code]
$("#dataTable").dataTable({
"bJQueryUI": false,
"bAutoWidth": false,
"bDeferRender": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"bStateSave": false,
"sDom": 'RlfCT<"clear">W<"clear">r<"tablediv"t>ip<"clear">',
"oColVis": {
"buttonText": " Show / hide columns"
},
"oColumnFilterWidgets": {
"aiExclude": [0]
},
"bProcessing": true,
"oTableTools": {
"aButtons": [
{
"sExtends": "collection",
"sButtonText": "Tools",
"aButtons": [ "csv", "xls", "pdf" ]
}
],
"sSwfPath": "resources/swf/copy_cvs_xls_pdf.swf"
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
];
});
[/code]
EDIT:
!!!!SOLUTION!!!
It seams that the DataTools plugin creates the DTTT_collection div just at the end of the body. If somebody tries to recreate a table from an ajax call by clearing the the original html and calling the DataTable() on the new one, the TableTools plugin tries to recreate the DTT_collection div and the flash object. Trying to recreate the flash object is what triggers the errors. The solution is to remove the DTTT_collection div along with the html table when recreating from ajax.
I hope this helps other people.
Any ideas?
This discussion has been closed.