TableTools Direct Initialization is not working
TableTools Direct Initialization is not working
dharmeshpatel82
Posts: 15Questions: 2Answers: 0
Hello,
I have initialized TableTools inside DataTable Initialization and It works perfectly, but For some reason I need to initialize TableTools on Button Click. so I Tried a test, I am initializing it just after DataTable got initialized.
[code]
$(document).ready(function () {
var oTable = $('#dTTTIntEx').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true
});
var oTableTools = new TableTools(oTable, {
"aButtons": [
"copy",
"csv",
"xls",
"pdf",
{ "stype": "print", "sButtonText": "Print me!" }
]
});
$('#demoDTTT').before(oTableTools.dom.container);
});
[/code]
I am getting this error :
[quote]
Line: 1400 - var oTableTools = new TableTools(oTable, {
Error: Object doesn't support this action
[/quote]
Can anybody have a suggestion for me. Thank you.
I have initialized TableTools inside DataTable Initialization and It works perfectly, but For some reason I need to initialize TableTools on Button Click. so I Tried a test, I am initializing it just after DataTable got initialized.
[code]
$(document).ready(function () {
var oTable = $('#dTTTIntEx').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true
});
var oTableTools = new TableTools(oTable, {
"aButtons": [
"copy",
"csv",
"xls",
"pdf",
{ "stype": "print", "sButtonText": "Print me!" }
]
});
$('#demoDTTT').before(oTableTools.dom.container);
});
[/code]
I am getting this error :
[quote]
Line: 1400 - var oTableTools = new TableTools(oTable, {
Error: Object doesn't support this action
[/quote]
Can anybody have a suggestion for me. Thank you.
This discussion has been closed.
Replies
Allan
Thank you very much for your fast response, I am using TableTools-2.2.0, Your solution works in that? Why we call TableTools like this, Please tell me? and I think somebody needs to update Direct initialization example in this site, That is not working.
Thank you very much for your help.
Allan
[quote] new $.fn.dataTable.TableTools( ... ); [/quote] works pretty well. Thank you very much for your guidance.
How do I close this discussion?
Allan
please can you put your script here, i need help whit the same problem
Where "oTable" is Datatable object.
Where oTable is DataTable Object
Where oTable is DataTable Object
Hi allan, first thank you and the DT community for your efforts, this is an excellent library. I had a similar issue as dharmeshpatel82 regarding direct initialization of TableTools which also resolved by your recommended (updated) method. Basically I had my table initialization setup as follows:
We're using the legacy Datatables version 1.9.4, but your recommended method of initialization still worked as expected. I was just curious why the first method doesn't work for this table since it seemed to work fine on another datatable I initialized in the same DOM context. Is this becuase the TableTools global object, which you mention would be removed in future releases, can only refer to one table at a time?
Because there is no
T
option in yoursDom
option. TableTools is only automatically initialised by DataTables if you include that option.The newer extensions are more flexible and the rewrite of TableTools will follow the new pattern.
Allan