There isn't a way of doing this in the initialisation object for DataTables (i.e the sDom and oTableTools parameters) currently (in future there will be, but that is part of the longer term plan for the development path of DataTables!).
However what you can do is use the TableTools constructor yourself. If you have a look at the TableTools source code you will see:
[code]
var oTT = new TableTools( oDTSettings.oInstance, oOpts );
TableTools._aInstances.push( oTT );
return oTT.dom.container;
[/code]
This is how it attaches and registers itself as a DataTables plug-in. The code simply creates a new TableTools instance with the DataTable object and your TableTools options. Then it adds the instance created to its internal static array (I should really move that to inside the main loop...) and then returns the element that has been created by TableTools for the DOM elements. You can use this method and then insert the 'dom.container' element where you want it in your document. The other option is to wrap this up into another DataTables feature plug-in, which, thinking about it, might be even easier.
This will register a new feature which you use in sDom as 'U' and look for init options called oTableTools2.
I have to say I've never tried this, so there might be some odd effects (honestly not sure when it comes to row selection etc), but this is the basic principle of how it would be done!
Replies
However what you can do is use the TableTools constructor yourself. If you have a look at the TableTools source code you will see:
[code]
var oTT = new TableTools( oDTSettings.oInstance, oOpts );
TableTools._aInstances.push( oTT );
return oTT.dom.container;
[/code]
This is how it attaches and registers itself as a DataTables plug-in. The code simply creates a new TableTools instance with the DataTable object and your TableTools options. Then it adds the instance created to its internal static array (I should really move that to inside the main loop...) and then returns the element that has been created by TableTools for the DOM elements. You can use this method and then insert the 'dom.container' element where you want it in your document. The other option is to wrap this up into another DataTables feature plug-in, which, thinking about it, might be even easier.
[code]
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
var oOpts = typeof oDTSettings.oInit.oTableTools2 != 'undefined' ?
oDTSettings.oInit.oTableTools2 : {};
var oTT = new TableTools( oDTSettings.oInstance, oOpts );
TableTools._aInstances.push( oTT );
return oTT.dom.container;
},
"cFeature": "U",
"sFeature": "TableTools Second Instance"
} );
[/code]
This will register a new feature which you use in sDom as 'U' and look for init options called oTableTools2.
I have to say I've never tried this, so there might be some odd effects (honestly not sure when it comes to row selection etc), but this is the basic principle of how it would be done!
Allan