fixedColumns
A single button that initialises and allows FixedColumns to be toggled.
Please note - this property requires the FixedColumns extension for DataTables.
Description
This button type initialises FixedColumns and then when pressed the columns are toggled between being fixed to the table and not fixed to the table.
Options
This button can have the following options set in its configuration object to customise its actions and display, in addition to those options which are available for all buttons (e.g. buttons.buttons.text
):
Name | Type | Default |
---|---|---|
action | ||
The action function for the FixedColumns button toggles whether FixedColumns is active on the table or not. | ||
config | {} | |
This option allows for FixedColumns to be configured as it would in a normal initialisation. All of the | ||
init | ||
For the FixedColumns button the init function sets up FixedColumns so that it is active and ready to be toggled immediately when the user presses the button. | ||
text | FixedColumns | |
This options allows the text within the button to be configured. This can also be configured with the |
Examples
Basic FixedColumns button initialisation:
$('#myTable').DataTable( {
buttons: [
'fixedColumns'
],
} );
Fix two columns left and another right:
new $.fn.dataTable.Buttons( table, {
buttons: [
{
extend: 'fixedColumns',
config: {
left: 2,
right: 1
}
}
],
} );