The ability to control the DOM positioning of the elements added by DataTables can be very powerful to a developer, and this is done through the sDom parameter. It is possible to add new 'features' to DataTables (such as a toolbar, or new interaction techniques) through it's inclusion in sDom, retaining the ability of the developer to leverage the flexibility of sDom for their layout.
To add a new feature to DataTables, you need to register some basic information with the DataTables core, through the use of the $.fn.dataTableExt.aoFeatures array. Each array element is an object which has the following parameters:
The following shows an example of this in use (this in fact is the plug-in registration used for TableTools
$.fn.dataTableExt.aoFeatures.push( { "fnInit": function( oSettings ) { return new TableTools( { "oDTSettings": oSettings } ); }, "cFeature": "T", "sFeature": "TableTools" } );
Once your plug-in is registered with DataTables, you can put whatever controls and logic you wish into the element that fnInit must create and return.