Since: Buttons 1.0.0

A single button that controls the visibility of one or more columns.
Please note - this property requires the Buttons extension for DataTables.


This button type creates a single button that can control the visibility of one or more columns in a DataTale (its counterpart columnsVisibility will be expanded to a single button for each column). This provides the ability to have show all / hide all buttons that control all of the table's columns or a subset of those columns.

For multiple columns, the button should be given a title using the buttons.buttons.text option, which can also be used for a single column control button, although it will automatically be given the column's title text if not otherwise supplied.


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):


DataTables initialisation: Show all / hide all buttons:

new DataTable('#myTable', {
	layout: {
		topStart: {
			buttons: [
					extend: 'columnVisibility',
					text: 'Show all',
					visibility: true
					extend: 'columnVisibility',
					text: 'Hide all',
					visibility: false