{hero}

copy

Since: Buttons 1.0.0

Copy table data to clipboard button.
Please note - this property requires the Buttons extension for DataTables.

Description

This button type serves as a proxy that will automatically detect if the copyHtml5 button can be used based on the browser's capabilities and the libraries available on the page.

This is provided as there is no API in HTML5 that allows a copy to clipboard action when clicking a button.

If the requirements of the copyHtml5 button are not satisfied, no button will be presented to the end user. For the requirements of each button type, please refer to its own documentation.

Options

This button can have the following options set in its configuration object to customise its actions and display:

Examples

DataTables initialisation: Use the copy button type to alias the HTML button options.:

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

DataTables initialisation: Use the exportOptions to copy only the current DataTable page:

$('#myTable').DataTable( {
	buttons: [
		{
			extend: 'copy',
			text: 'Copy current page',
			exportOptions: {
				modifier: {
					page: 'current'
				}
			}
		}
	]
} );