TypeError: TableTools is not a constructor
TypeError: TableTools is not a constructor
mdalvi
Posts: 2Questions: 0Answers: 0
I am working with TableTools 2.2.0 and I am trying to initialise TableTools using "new" keyword as explained in http://datatables.net/extras/tabletools/initialisation
My code is as follows:
[code]
[/code]
Javascript:
[code]
var tblmain = $("#tblmain").dataTable({
"sDom": 'T<"clear">lfrtip',
"sScrollY": 600,
"bPaginate": true,
"bScrollCollapse": true
});
var oTableTools= new TableTools( tblmain, {
"sSwfPath": "assets/plugins/DataTables-1.9.4/TableTools-2.2.0/swf/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [
{
"sExtends": "copy",
"bSelectedOnly": true
},
{
"sExtends": "print",
"bSelectedOnly": true
},
{
"sExtends": "csv",
"bSelectedOnly": true
},
{
"sExtends": "xls",
"bSelectedOnly": true
},
{
"sExtends": "pdf",
"bSelectedOnly": true
}]
});
$('#div_sheet').before( oTableTools.dom.container );
[/code]
This causes my firebug console saying:
-----------------------------------------
TypeError: TableTools is not a constructor
"bSelectedOnly": true
-----------------------------------------
However, if I write all TableTools options using oTableTools property along with datatable options everything works fine, so why such error when initialising using "new" keyword?
Apologize but I tried to post the test case using http://live.datatables.net but I could not replicate the situation.
Thanks..
My code is as follows:
[code]
[/code]
Javascript:
[code]
var tblmain = $("#tblmain").dataTable({
"sDom": 'T<"clear">lfrtip',
"sScrollY": 600,
"bPaginate": true,
"bScrollCollapse": true
});
var oTableTools= new TableTools( tblmain, {
"sSwfPath": "assets/plugins/DataTables-1.9.4/TableTools-2.2.0/swf/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [
{
"sExtends": "copy",
"bSelectedOnly": true
},
{
"sExtends": "print",
"bSelectedOnly": true
},
{
"sExtends": "csv",
"bSelectedOnly": true
},
{
"sExtends": "xls",
"bSelectedOnly": true
},
{
"sExtends": "pdf",
"bSelectedOnly": true
}]
});
$('#div_sheet').before( oTableTools.dom.container );
[/code]
This causes my firebug console saying:
-----------------------------------------
TypeError: TableTools is not a constructor
"bSelectedOnly": true
-----------------------------------------
However, if I write all TableTools options using oTableTools property along with datatable options everything works fine, so why such error when initialising using "new" keyword?
Apologize but I tried to post the test case using http://live.datatables.net but I could not replicate the situation.
Thanks..
This discussion has been closed.
Replies
I think it should be resolve there.
I would also point out that `new $.fn.dataTable.TableTools(...)` is now the preferred form. The `TableTools` global is still in 2.2.x, but will be removed in 2.3+.
Allan
Ooh and thanks for the additional info