Multiple DIFFERENT TableTools attached to the same table?
Multiple DIFFERENT TableTools attached to the same table?
cameron
Posts: 1Questions: 0Answers: 0
Is there any way to create multiple different sets of table tools and attach them to the same table?
I want to have the select/deselect options in a different location to the main row operation buttons.
Cheers,
Cameron
I want to have the select/deselect options in a different location to the main row operation buttons.
Cheers,
Cameron
This discussion has been closed.
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