Since: Buttons 1.0.0

A button collection that provides column visibility control.
Please note - this property requires the Buttons extension for DataTables.


This button will create a collection button that when activated will show a list of the columns in the table and provide the end user with the ability to toggle column visibility to suit their own requirements.


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 the colvis button with default options:

$('#myTable').DataTable( {
	buttons: [ 'colvis' ]
} );

Direct initialisation: Show the colvis button, but do not include the first column in the list of columns:

new $.fn.dataTable.Buttons( table, {
	buttons: [
			extend: 'colvis',
			columns: 'th:nth-child(n+2)'
} );

Customisation of the button text for the individual columns:

$('#myTable').DataTable( {
	dom: 'Bfrtip',
	buttons: [ {
		extend: 'colvis',
		columnText: function ( dt, idx, title ) {
			return (idx+1)+': '+title;
	} ]
} );