Initialisation › Options
aButtons
Show details
This parameter defined the buttons that TableTools will use and provides the primary focus for customisation of TableTools. In its basic form the elements of this array are strings which match the predefined buttons, but the elements can also
be objects which define your own buttons, or override the default actions. This is fully explained on the Buttons page.
Default:
[ "copy", "csv", "xls", "pdf", "print" ]
Type:
Array
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"aButtons": [ "copy", "print" ]
}
} );
} );
fnPreRowSelect
Show details
This is a callback function which is fired just prior to a row being selected (i.e. the mouse down has occurred, but TableTools has not yet selected the row). It can be used to cancel the selection if needed.
Default:
Input parameters:
event : click event which occurred to select this row
array - node : TR elements to be selected
Return parameter:
Boolean - true if the row can be selected, false if it cannot.
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"fnPreRowSelect": function ( e, nodes ) {
if ( e.currentTarget.className.indexOf('no_select') != -1 ) {
return false;
}
return true;
}
}
} );
} );
fnRowDeselected
Show details
Callback function which is called when a row is deselected (i.e. the opposite of fnRowSelected).
Default:
Input parameters:
array - node : TR elements that were deselected
Return parameter:
void
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'Tlfrtip',
"tableTools": {
"fnRowDeselected": function ( nodes ) {
alert( 'The row with ID '+nodes[0].id+' was deselected' );
}
}
} );
} );
fnRowSelected
Show details
Callback function which occurs when a row is selected. This allows a particular action to occur when any row is selected (a selected row counter for example).
Default:
Input parameters:
array - node : TR elements that were selected
Return parameter:
void
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'Tlfrtip',
"tableTools": {
"fnRowSelected": function ( nodes ) {
alert( 'The row with ID '+nodes[0].id+' was selected' );
}
}
} );
} );
sRowSelect
Show details
TableTools provides everything that is needed to allow the end user to select rows in a table (by clicking on them). This is disabled by default, but can be readily enabled by setting this property to either "single" (to allow only one row in
the table to be selected at a time), or "multi" (to allow any number of rows to be selected).
Default:
none
Type:
String
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sRowSelect": "single"
}
} );
} );
sRowSelector
Show details
By default when row selection is active, TableTools will select a row when any element in the table is clicked. It can be useful to limit this selection to certain columns, or even certain elements in the row, which can be done through this option. It is a simple jQuery selector string that is used to select the elements that will perform the select..
Default:
tr
Type:
String
Code example:
$(document).ready( function () {
// Select the row on click or all but the first column
$('#example').dataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sRowSelector": "td:not(:first-child)"
}
} );
} );
sSelectedClass
Show details
Set the class used to indicate that a row has been selected by the end user.
Default:
DTTT_selected
Type:
String
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'Tlfrtip',
"tableTools": {
"sRowSelect": "multi",
"sSelectedClass": "row_selected"
}
} );
} );
sSwfPath
Show details
Define the path of the SWF to be used by TableTools for copy to clipboard and saving a file locally operations. If you are having problems with these operations, but not printing, this is very likely to be the issue.
Default:
media/swf/copy_csv_xls_pdf.swf
Type:
String
Code example:
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'Tlfrtip',
"tableTools": {
"sSwfPath": "/swf/copy_csv_xls_pdf.swf"
}
} );
} );